hyperlink in ruby on rails
This is something probably trivial but i can't quite find my way round it: How do i add a hyperlink from one ruby-file.html.erb to another please? ...
This is something probably trivial but i can't quite find my way round it: How do i add a hyperlink from one ruby-file.html.erb to another please? ...
I am new to rails so go easy. I have created a blog. I have successfully implemented comments and attached them to each post. Now...I would like to display, in the sidebar, a list of the most recent comments from across all posts. I think there are two things involved here, an update to the comment_controller.rb, and then the call from t...
I'm just starting with the depot application in the Pragmatic Programmer's Rails book. When I try doing a rake db:create RAILS_ENV-'development' after creating a rails application, I get the following error: Couldn't create database for {"encoding"=>"utf8", "username"=>"root", "adapter"=>"mysql", "database"=>"depot_development", "pool"=...
I've been reading up on the Sphinx search engine and the Thinking Sphinx gem. In the TS docs it says... Sphinx has one major limitation when compared to a lot of other search services: you cannot update the fields [of] a single document in an index, but have to re-process all the data for that index. If I understand correctly, that...
Hi! I have a little bit of trouble creating a menu in Rails. In ApplicationController I have a set_menu method: def self.set_menu(menu, options = {}) # ... end This is called from each controller like this: class UsersController < ApplicationController set_menu :users # ... end In set_menu, I need to create a variable that ...
I am using caches_action to cache one of the action's response I want to save in the cache compression response and then send it as it is if browser supports that compression otherwise decompress it and then send it. Some characteristics of my content: 1. It rarely changes 2. My server gets requests from 90% gzip enabled browsers Do y...
When we try to deserialize a Model from our database we always receive a YAML object. For that we added the following code in the environment.rb: YAML.add_domain_type("ActiveRecord,2007", "") do |type, val| klass = type.split(":").last.constantize YAML.object_maker(klass, val) end class ActiveRecord::Base def to_yaml_type "!A...
I have searched a lot, but did not find anything useful, so I just ask. The context is Rails 2.3.x, the usual javascript libraries. I would like to reach the following: I would like to have something similar to <%= text_field_with_auto_complete :recipe, :name %> but on text editors: <%= text_editor_with_auto_complete :recipe, :descript...
How can i autoreload every few seconds a partial, just like in twitter seach. i am using rails and hobo. ...
Does anyone know of a way to build a pivot table using activerecord which would be remotely DB neutral? I've tried to avoid using find_by_sql and DB specific queries but for a pivot table or crosstab query I have no idea how to do it in a way which is not specific to say MySQL. IE my mySQL find_by_sql breaks on a postgresql DB. I foun...
I have a few models: class StatsParent < ActiveRecord::Base class CourseStat < StatsParent class PlayerCourseStat < CourseStat I have the Course model set up as such: class Course < ActiveRecord::Base has_one :course_stat has_many :player_course_stats def update_stats(plyr_rnd) puts self.course_stat # this puts #<PlayerC...
Working on a request to add a pretty tooltip to a page (using jQuery tooltip plugin, as recommended by others on my team). Pretty tooltip is working fine, but two of the existing specs now fail, an example below: describe 'with a discussion post containing html' do before(:each) do @post.update_attributes(:body => "some <strong>...
I have a multilingual admin (for English and Portuguese) that needs to save data for both languages at the same time, like Description EN field and Description PT field in the same form. Globalize2 makes some magic and I don't know exactly how to save this. I'll post my controller action here, that obviously needs some refactoring. Than...
I've had to add features to an application that depends on a database from another application. I've been able to set up a connection to this external database and pull data from it. However, I'm not sure how to get my main application to create a test database for this external application. It would be awesome if there some way to pul...
I am planning to do a small web application that will be distributed as a single installable. I have plans to develop this application in either Python/Django or RoR. (I am a Java/C++ programmer, hence both these languages are new to me). My main concern is about the size and simplicity of final installable (say setup.exe). I want it t...
I'm a beginner at Ruby on Rails so I apologize if this is quite obvious, but I'm trying to learn how to write the database migration scripts and I'd like to change the following long_description to a text value instead of string: class CreateArticles < ActiveRecord::Migration def self.up create_table :articles do |t| t.col...
I have a model with many children (selections). I need to display the children using fields for but I really want to group them based on an attribute on each selection using group_by. Currently I am using accepts_nested_attributes_for :selections, :allow_destroy => true So my form looks a bit like this: <% form_for @match do |form|...
Hi I'm trying to access my web app built with rails. But when I type the URL I get: 500 Internal Server Error If you are the administrator of this website, then please read this web application's log file to find out what went wrong. And in the log there's: /!\ FAILSAFE /!\ Mon Nov 23 10:56:03 -0500 2009 Status: 500 Internal Server ...
So I have a method and corresponding partial for including a set of random photos in the sidebar of certain areas of our site. Right now I have a random_photos method in ApplicationController set with a before_filter. That works in the sense that it makes the contents of the random_photos method available wherever I need it, but it als...
I've got a web-app that I want to migrate to Rails, which is currently just plain HTML with an Apache proxy to another server, running a custom database/webserver that serves the site's dynamic content. For the moment, I want to do a staged move, since the content on the proxied server I won't be able to update until I update the static...