Class: Eventable::OpeningPeriodlist

Inherits:
Object
  • Object
show all
Defined in:
app/models/eventable/opening_periodlist.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event) ⇒ OpeningPeriodlist

Returns a new instance of OpeningPeriodlist.



6
7
8
9
# File 'app/models/eventable/opening_periodlist.rb', line 6

def initialize(event)
  @event = event
  @items = event.opening_periods.all
end

Instance Attribute Details

#eventObject (readonly)

Returns the value of attribute event.



3
4
5
# File 'app/models/eventable/opening_periodlist.rb', line 3

def event
  @event
end

#itemsObject (readonly)

Returns the value of attribute items.



3
4
5
# File 'app/models/eventable/opening_periodlist.rb', line 3

def items
  @items
end

Instance Method Details

#add_blankObject



15
16
17
# File 'app/models/eventable/opening_periodlist.rb', line 15

def add_blank
  @items << @event.opening_periods.build
end

#errorsObject



11
12
13
# File 'app/models/eventable/opening_periodlist.rb', line 11

def errors
  ActiveRecord::Errors.new(self)
end

#items_attributes=(attr) ⇒ Object



19
20
21
# File 'app/models/eventable/opening_periodlist.rb', line 19

def items_attributes=(attr)
  @event.opening_periods_attributes=(attr)
end

#update_attributes(attrs) ⇒ Object



23
24
25
26
27
28
# File 'app/models/eventable/opening_periodlist.rb', line 23

def update_attributes(attrs)
  attrs.each do |k,v|
    send "#{k}=", v
  end
  save
end