If you use the namespace route like the one below : map.namespace :user do |user| user.resources :invitations end Make sure you have the links like the following; <% form_for([:user,@invitations]) do |f| %> Don’t try with; <% form_for([@user,@invitation]) do |f| %>
Archive for the ‘Ruby on Rails’ Category
Rails resources error – undefined method ‘site_*’ -using namespace
Posted in Ruby on Rails, Weird Errors, tagged bug fixes, Ruby on Rails on December 8, 2008 | Leave a Comment »
Rails Migration symbols – Data Types
Posted in Ruby on Rails, tagged lessons, programming, Ruby on Rails on December 4, 2008 | Leave a Comment »
Migration column type… Converts to MySQL field type… Available options :binary TINYBLOB, BLOB, MEDIUMBLOB, or LONGBLOB2 :limit => 1 to 4294967296 (default = 65536)2 :boolean TINYINT(1) – :date DATE – :datetime DATETIME – :decimal DECIMAL :precision => 1 to 63 (default = 10) :scale => 0 to 30 (default = 0)3 :float FLOAT – :integer [...]
undefined method ‘model’ in application.rb
Posted in Ruby on Rails, Weird Errors, tagged bug fixes, Ruby on Rails on December 1, 2008 | Leave a Comment »
I think you’re running Rails 2. This line will work only with Rails 1. The ‘model’ method is no longer supported.Remove that line from the code. (E.g) undefined method `model’ for ApplicationController:Class – Line 12 in applicaton.rb
Undefined method ‘cache_template_extensions=’
Posted in Ruby on Rails, tagged bug fixes, Ruby on Rails on December 1, 2008 | 1 Comment »
The simple fix is to remove it from my config/environments/development.rb (or) production.rb file as it’s now been deprecated.
Install Ferret on windows
Posted in Ruby on Rails, tagged installations, lessons, Ruby on Rails on December 1, 2008 | Leave a Comment »
Download the ferret gem for windows from http://rubyforge.org/frs/?group_id=1028 (E.g) http://rubyforge.org/frs/download.php/34135/ferret-0.11.6-mswin32.gem Move to the directory where you downloaded the gem (cd Desktop/<download-location>) and do gem install <filename> (E.g) gem install ferret-0.11.6-mswin32.gem You may also need, gem install acts_as_ferret, for your project.
The dynamic link library LIBMYSQL.dll could not be found in the specified path
Posted in Ruby on Rails, Weird Errors, tagged MySQL, Ruby on Rails, tips, windows on November 25, 2008 | Leave a Comment »
When you find this error alert in windows, make sure you do one of the following; Find the LIBMYSQL.dll file and add its location to the PATH(environment-variable) (or) copy LIBMYSQL.dll to the System32 directory.
Better Exception handling
Posted in Ruby on Rails, tagged programming, Ruby on Rails, tips on November 20, 2008 | Leave a Comment »
The first thing is, we can have something like inline exception handlers. rescue_from ActiveRecord::RecordNotFound do render :file => ‘/bad_record’, :status => 404 end Block can even take have an argument for exception object. rescue_from ActiveRecord::RecordInvalid do |exception| render :action => (exception.record.new_record? ? ‘new’ : ‘edit’) end The above method will be helpful if we use [...]
Rails flash[:notice] problem
Posted in Ruby on Rails, tagged bug fixes, lessons, Ruby on Rails, tips on November 20, 2008 | Leave a Comment »
flash[:notice] is meant only for redirect action, because the message is only cleared after the redirected view request. So if you don’t redirect the request, and you click on the next request, that message will still be displayed. But sometimes, we just want to display custom error messages only for current request without the redirection [...]
Running Rails code through cron job
Posted in Ruby on Rails, tagged lessons, programming, Ruby on Rails, tips on November 20, 2008 | Leave a Comment »
Rails comes with a script/runner script that can be used to run the code in your Rails app. There’re many ways to organize your code to let this runner script execute it, but one obvious way is to write the code as a model’s action. Here are quick steps for doing this: 1. Insert the [...]
Why Rails?
Posted in Ruby on Rails, tagged funs, lessons, programming, Ruby on Rails, tips on October 24, 2008 | Leave a Comment »