I have some table events
that is populated by users. My users can edit data in this table, but when this is done I'm required to populate another database with an event_historics
table.
I tried to
@event = Event.find(id_event)
EventHistoric.create @event.map(&:serializable_hash)
But i get an undefined method map for
error.
Using the object directly in the create
function gives an undefined method stringify_keys for
error.
Is there an easy workaround for this?
I believe what you are looking for here is:
EventHistoric.create @event.attributes