Class: Eventable::OpeningTimelist
- Inherits:
-
Object
- Object
- Eventable::OpeningTimelist
- Defined in:
- app/models/eventable/opening_timelist.rb
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#opening_period ⇒ Object
readonly
Returns the value of attribute opening_period.
Instance Method Summary collapse
- #add_blank ⇒ Object
- #errors ⇒ Object
-
#initialize(opening_period) ⇒ OpeningTimelist
constructor
A new instance of OpeningTimelist.
- #items_attributes=(attr) ⇒ Object
- #update_attributes(attrs) ⇒ Object
Constructor Details
#initialize(opening_period) ⇒ OpeningTimelist
Returns a new instance of OpeningTimelist.
6 7 8 9 |
# File 'app/models/eventable/opening_timelist.rb', line 6 def initialize(opening_period) @opening_period = opening_period @items = opening_period.opening_times.all end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
3 4 5 |
# File 'app/models/eventable/opening_timelist.rb', line 3 def items @items end |
#opening_period ⇒ Object (readonly)
Returns the value of attribute opening_period.
3 4 5 |
# File 'app/models/eventable/opening_timelist.rb', line 3 def opening_period @opening_period end |
Instance Method Details
#add_blank ⇒ Object
15 16 17 |
# File 'app/models/eventable/opening_timelist.rb', line 15 def add_blank @items << @opening_period.opening_times.build end |
#errors ⇒ Object
11 12 13 |
# File 'app/models/eventable/opening_timelist.rb', line 11 def errors ActiveRecord::Errors.new(self) end |
#items_attributes=(attr) ⇒ Object
19 20 21 |
# File 'app/models/eventable/opening_timelist.rb', line 19 def items_attributes=(attr) @opening_period.opening_times_attributes=(attr) end |
#update_attributes(attrs) ⇒ Object
23 24 25 26 27 28 |
# File 'app/models/eventable/opening_timelist.rb', line 23 def update_attributes(attrs) attrs.each do |k,v| send "#{k}=", v end save end |