2015-03-23 07:21:53 +01:00
|
|
|
class ItemGroup < ActiveRecord::Base
|
2015-04-21 06:39:30 +02:00
|
|
|
|
|
|
|
|
has_many :item_in_groups
|
|
|
|
|
has_many :items, through: :item_in_groups
|
2015-03-23 07:21:53 +01:00
|
|
|
|
|
|
|
|
def all_items(offset, limit)
|
2015-04-21 06:39:30 +02:00
|
|
|
self.items.where(on_display: true).order("item_in_groups.position").limit(limit).offset(offset).all
|
2015-03-23 07:21:53 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|