Fresh Mix wrote: > @row = Post.find(5) > > How can I save it as a new row? > > Post.new(@row) ?? Do I need to destroy an old id?
Did you have a look at ActiveRecord::clone (http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M002278) ? The following might work for you : @row = Post.find(5) clone = @row.clone clone.save (NB: The associations won't be cloned, only attributes) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

