Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Customer < ActiveRecord::Base
- has_many :settings, inverse_of: :customer, dependent: :destroy do
- def prepare_setting(api_setting)
- find_or_initialize_by(api_id: api_setting[:api_id]).tap do |api_set|
- api_set.description = api_setting[:description]
- # Some other stuff here
- end
- end
- end
- def prepare_settings
- API.settings.each do |api_setting|
- settings.prepare_setting(api_setting)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement