Class: Eventable::OpeningPeriodlist
- Inherits:
-
Object
- Object
- Eventable::OpeningPeriodlist
- Defined in:
- app/models/eventable/opening_periodlist.rb
Instance Attribute Summary collapse
-
#event ⇒ Object
readonly
Returns the value of attribute event.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
Instance Method Summary collapse
- #add_blank ⇒ Object
- #errors ⇒ Object
-
#initialize(event) ⇒ OpeningPeriodlist
constructor
A new instance of OpeningPeriodlist.
- #items_attributes=(attr) ⇒ Object
- #update_attributes(attrs) ⇒ Object
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
#event ⇒ Object (readonly)
Returns the value of attribute event.
3 4 5 |
# File 'app/models/eventable/opening_periodlist.rb', line 3 def event @event end |
#items ⇒ Object (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_blank ⇒ Object
15 16 17 |
# File 'app/models/eventable/opening_periodlist.rb', line 15 def add_blank @items << @event.opening_periods.build end |
#errors ⇒ Object
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 |