Module: Fcid::UserMethods::ClassMethods

Defined in:
lib/fcid/user_methods.rb

Instance Method Summary collapse

Instance Method Details

#sync(id) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'lib/fcid/user_methods.rb', line 25

def sync(id)
  user_res = Fcid::User.find(id)
  user = find_or_initialize_by_id(id)
  Fcid.columns.each do |key,value|
    user.send(:write_attribute,key,user_res.send(value))
  end
  user.after_sync if user.respond_to?(:after_sync) # can add other initialize code
  user.save!
  user
end