Module: Features::ActiveRecordExtension::InstanceMethods

Defined in:
lib/features/active_record_extension.rb

Instance Method Summary collapse

Instance Method Details

#features?(*feature_names) ⇒ Boolean

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

Returns:

  • (Boolean)


57
58
59
# File 'lib/features/active_record_extension.rb', line 57

def features?(*feature_names)
  feature_names.all? { |feature_name| features.send("#{feature_name}?") }
end

#update_attributes_with_features(attributes) ⇒ Object



61
62
63
64
# File 'lib/features/active_record_extension.rb', line 61

def update_attributes_with_features(attributes)
  update_feature_attributes(attributes)
  update_attributes_without_features(attributes)
end

#update_attributes_with_features!(attributes) ⇒ Object



66
67
68
69
# File 'lib/features/active_record_extension.rb', line 66

def update_attributes_with_features!(attributes)
  update_feature_attributes(attributes)
  update_attributes_without_features!(attributes)
end