Module: Mongoid::TaggableWithContext::GroupBy::TaggableWithContext::ClassMethods
- Defined in:
- lib/mongoid/taggable_with_context/group_by/taggable_with_context.rb
Instance Method Summary collapse
- #get_tag_group_by_field_for(context) ⇒ Object
- #taggable(*args) ⇒ Object
- #tags_for(context, group_by, conditions = {}) ⇒ Object
- #tags_with_weight_for(context, group_by, conditions = {}) ⇒ Object
Instance Method Details
#get_tag_group_by_field_for(context) ⇒ Object
38 39 40 |
# File 'lib/mongoid/taggable_with_context/group_by/taggable_with_context.rb', line 38 def get_tag_group_by_field_for(context) self.[context][:group_by_field] end |
#taggable(*args) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/mongoid/taggable_with_context/group_by/taggable_with_context.rb', line 7 def taggable(*args) super(*args) args. = (args.blank? ? :tags : args.shift).to_sym self.[].reverse_merge!(:group_by_field => nil) class_eval "class << self\ndef \#{tags_field}(group_by=nil)\ntags_for(:\"\#{tags_field}\", group_by)\nend\n\ndef \#{tags_field}_with_weight(group_by=nil)\ntags_with_weight_for(:\"\#{tags_field}\", group_by)\nend\n\ndef \#{tags_field}_group_by_field\nget_tag_group_by_field_for(:\"\#{tags_field}\")\nend\nend\n" end |
#tags_for(context, group_by, conditions = {}) ⇒ Object
30 31 32 |
# File 'lib/mongoid/taggable_with_context/group_by/taggable_with_context.rb', line 30 def (context, group_by, conditions={}) raise AggregationStrategyMissing end |
#tags_with_weight_for(context, group_by, conditions = {}) ⇒ Object
34 35 36 |
# File 'lib/mongoid/taggable_with_context/group_by/taggable_with_context.rb', line 34 def (context, group_by, conditions={}) raise AggregationStrategyMissing end |