Module: ActiveResource::ActsAsAuthenticatable::InstanceMethods
- Defined in:
- lib/active_resource/acts_as_authenticatable.rb
Instance Method Summary collapse
Instance Method Details
#sync ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/active_resource/acts_as_authenticatable.rb', line 41 def sync if self.class.sync && !self.class.sync_to.nil? user = self.dup last_update = user.attributes.delete "updated_at" local_user = self.class.sync_to.find_or_initialize_by_username user.username, user.attributes unless local_user.new_record? local_user.update_attributes user.attributes else local_user.save end else false end end |