Module: Rubix::Associations::BelongsToItem

Included in:
TimeSeries
Defined in:
lib/rubix/associations/belongs_to_item.rb

Instance Method Summary collapse

Instance Method Details

#itemObject



12
13
14
15
16
# File 'lib/rubix/associations/belongs_to_item.rb', line 12

def item
  return @item if @item
  return unless @item_id
  @item = Item.find(:id => @item_id)
end

#item=(i) ⇒ Object



6
7
8
9
10
# File 'lib/rubix/associations/belongs_to_item.rb', line 6

def item= i
  return unless i
  @item    = i
  @item_id = i.id
end

#item_idObject



23
24
25
26
27
# File 'lib/rubix/associations/belongs_to_item.rb', line 23

def item_id
  return @item_id if @item_id
  return unless @item
  @item_id = @item.id
end

#item_id=(iid) ⇒ Object



18
19
20
21
# File 'lib/rubix/associations/belongs_to_item.rb', line 18

def item_id= iid
  return unless iid
  @item_id = iid
end