Posted By

inkdeep on 03/10/10


Tagged

rails ruby copy duplicate hash


Versions (?)

Copy object Attributes to another object in Ruby


 / Published in: Ruby
 

  1. #For syncing models between db's/tables/whateva:
  2. local.attributes = remote.attributes.inject({}){|h,(k,v)| h[k]=v if Model.column_names.include?(k); h }

Report this snippet  

You need to login to post a comment.