Module: Rubix::Associations::HasManyItems
- Included in:
- Trigger
- Defined in:
- lib/rubix/associations/has_many_items.rb
Instance Method Summary collapse
Instance Method Details
#item_ids ⇒ Object
22 23 24 25 26 |
# File 'lib/rubix/associations/has_many_items.rb', line 22 def item_ids return @item_ids if @item_ids return unless @items @item_ids = @items.map(&:id) end |
#item_ids=(iids) ⇒ Object
17 18 19 20 |
# File 'lib/rubix/associations/has_many_items.rb', line 17 def item_ids= iids return unless iids @item_ids = iids end |
#items ⇒ Object
11 12 13 14 15 |
# File 'lib/rubix/associations/has_many_items.rb', line 11 def items return @items if @items return unless @item_ids @items = @item_ids.map { |iid| Item.find(:id => iid, :host_id => (host_id || template_id)) } end |
#items=(is) ⇒ Object
5 6 7 8 9 |
# File 'lib/rubix/associations/has_many_items.rb', line 5 def items= is return unless is @items = is @item_ids = is.map(&:id) end |