Module: Sapling::ActiveRecord::ClientAPI
- Included in:
- Sapling::ActiveRecord
- Defined in:
- lib/sapling/active_record.rb
Instance Method Summary collapse
-
#active?(feature, options = {}) ⇒ Boolean
see Sapling::API::Client.
-
#active_features(options = {}) ⇒ Object
returns a list of features enabled for a user see Sapling::API::Client.
- #features ⇒ Object
Instance Method Details
#active?(feature, options = {}) ⇒ Boolean
see Sapling::API::Client
24 25 26 27 28 |
# File 'lib/sapling/active_record.rb', line 24 def active?(feature, ={}) = Util. v = Model.count(:conditions => query_conditions(feature,)) v > 0 end |
#active_features(options = {}) ⇒ Object
returns a list of features enabled for a user see Sapling::API::Client
37 38 39 40 41 |
# File 'lib/sapling/active_record.rb', line 37 def active_features(={}) = Util. features = Model.find :all, :conditions => query_conditions(nil,) features.map {|record| record.feature.to_sym}.uniq end |
#features ⇒ Object
30 31 32 33 |
# File 'lib/sapling/active_record.rb', line 30 def features features = Model.find :all, :select => "feature", :group => "feature", :order => "feature" features.map {|record| record.feature.to_sym} end |