find_or_create_by is your friend (Dynamic attribute-based finders at ActiveRecord::Base)
Related topics
| Topic | Replies | Views | Activity | |
|---|---|---|---|---|
| is there an activerecord method like "FIND EXISTING OR CREATE NEW IF NONE FOUND"? | 2 | 133 | December 22, 2008 | |
| Rails 2.0 missing find_or_create_by_name and find_or_initialize_by_name | 3 | 196 | October 19, 2007 | |
| Best way to do a find_by_or_create based on an attribute? | 7 | 266 | December 16, 2010 | |
| [Issue #5097] attributeless find_or_create/find_or_initialize | 0 | 357 | July 12, 2010 | |
| ActiveRecord 'find_or_initialize_by' dynamic finder bug? Ignoring conditions. | 1 | 139 | February 7, 2008 |