Module: HasSettings::ActiveRecordExtension::InstanceMethods

Defined in:
lib/has_settings/active_record_extension.rb

Instance Method Summary collapse

Instance Method Details

#settings?(*setting_names) ⇒ Boolean

Allows you to check for multiple features like account.settings?(:suggestions, :suggestions_on_web)

Returns:

  • (Boolean)


45
46
47
# File 'lib/has_settings/active_record_extension.rb', line 45

def settings?(*setting_names)
  setting_names.all? { |setting_name| settings.send("#{setting_name}?") }
end

#update_attributes_with_settings(attributes) ⇒ Object



49
50
51
52
# File 'lib/has_settings/active_record_extension.rb', line 49

def update_attributes_with_settings(attributes)
  update_settings_attributes(attributes)
  update_attributes_without_settings(attributes)
end

#update_attributes_with_settings!(attributes) ⇒ Object



54
55
56
57
# File 'lib/has_settings/active_record_extension.rb', line 54

def update_attributes_with_settings!(attributes)
  update_settings_attributes(attributes)
  update_attributes_without_settings!(attributes)
end