Copy object Attributes to another object in Ruby


/ Published in: Ruby
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.