I am trying to duplicate a resource in Rails in my application and have encountered some problems.
Customization: I have a library of “element templates” that the user can use, and then modify the resulting element. I now have this setting:
@temp_item = @template_item.dup
@new_item = @user.items.create(@temp_item.attributes)
However, I ran into a problem when it tries to copy through protected attributes as well (namely created_at and updated_at). I would prefer not to list each attribute separately, so my question is: is there a way to exclude attributes that are copied in this instance?
Thank.
source
share