Method: Synced::Model#synchronize
- Defined in:
- lib/synced/model.rb
#synchronize(options = {}) ⇒ Object
Performs synchronization of given remote objects to local database.
Rental.synchronize(remote: remote_rentals, scope: website)
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/synced/model.rb', line 83 def synchronize( = {}) .symbolize_keys! .assert_valid_keys(:api, :fields, :include, :remote, :remove, :scope) [:remove] = synced_remove unless .has_key?(:remove) [:include] = Array(synced_include) unless .has_key?(:include) [:fields] = Array(synced_fields) unless .has_key?(:fields) .merge!({ id_key: synced_id_key, synced_data_key: synced_data_key, synced_all_at_key: synced_all_at_key, data_key: synced_data_key, local_attributes: synced_local_attributes, associations: synced_associations, only_updated: synced_only_updated, mapper: synced_mapper }) Synced::Synchronizer.new(self, ).perform end |