Module: BucketMaker::Models::ActiveRecordable::InstanceMethods
- Includes:
- Bucketable
- Defined in:
- lib/bucket_maker/models/active_recordable.rb
Instance Method Summary
collapse
Methods included from Bucketable
#bucketize!, #bucketize_for_series_and_bucket!, #force_to_bucket!, #in_bucket?, #not_in_bucket?
Instance Method Details
#group_for_key(series_key) ⇒ Object
22
23
24
25
26
|
# File 'lib/bucket_maker/models/active_recordable.rb', line 22
def group_for_key(series_key)
if b = buckets.select('group_name').where(series_key: series_key).take
b.group_name
end
end
|
#set_group_for_key(series_key, group_name) ⇒ Object
28
29
30
31
|
# File 'lib/bucket_maker/models/active_recordable.rb', line 28
def set_group_for_key(series_key, group_name)
buckets.where(series_key: series_key, group_name: group_name).first_or_create
true
end
|