Mr eel

Rails Gotcha: Parameter Names

There are a few problems I’ve had while working with Ruby on Rails. Most of them stem from my ignorance of the system. Here’s one tip I can offer. If you’re ever having problems that you can’t figure out, make sure you aren’t using a reserved word in your code.

For example I was trying to save a collection of records along with their parent record. The table name for the collection was ‘actions’. Trying to access @params[:action] in the controller in order to get the info from the browser and into the database was just not working. See, the key :action is actually used by rails to figure out which method to call in the controller. Oops!

Posted on July 21st, 2005 | There are 0 comments

Comments

Add a comment

All contents © 2005—2007 Luke Matthew Sutton