Jose Hales-Garcia
2006-Jun-15 16:13 UTC
[Rails] Best practice for params key names for mapping to models
What''s the best practice for naming keys in the params array so they map most efficiently to models? There isn''t an equivelent of ActiveRecord for mapping params keys to models, so I''m wondering if there is a best practice. I''m writing an addressbook with a form that has mixed models on it and multiple one-to-many relations. I''m processing new records in the create method and updating records in the update method. I''d like to have one method to handle both create and update (an attempt to dry up my code). I''m using my own naming convention in params for new records, the model name with "new_" appended. I''m thinking how I might be able to right this all-in-one method (both create and update method). My hunch is that a proper naming scheme for the params keys would make it easier. -- Posted via http://www.ruby-forum.com/.