Class: Calagator::Event::Saver
- Inherits:
-
Struct
- Object
- Struct
- Calagator::Event::Saver
- Defined in:
- app/models/calagator/event/saver.rb
Instance Attribute Summary collapse
-
#event ⇒ Object
Returns the value of attribute event.
-
#failure ⇒ Object
Returns the value of attribute failure.
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
Instance Attribute Details
#event ⇒ Object
Returns the value of attribute event
5 6 7 |
# File 'app/models/calagator/event/saver.rb', line 5 def event @event end |
#failure ⇒ Object
Returns the value of attribute failure
5 6 7 |
# File 'app/models/calagator/event/saver.rb', line 5 def failure @failure end |
#params ⇒ Object
Returns the value of attribute params
5 6 7 |
# File 'app/models/calagator/event/saver.rb', line 5 def params @params end |
Instance Method Details
#has_new_venue? ⇒ Boolean
16 17 18 19 20 |
# File 'app/models/calagator/event/saver.rb', line 16 def has_new_venue? return unless event.venue event.venue.previous_changes['id'] == [nil, event.venue.id] && params[:venue_name].present? end |
#save ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'app/models/calagator/event/saver.rb', line 6 def save event.attributes = params[:event] || {} event.venue = find_or_initialize_venue event.start_time = [params[:start_date], params[:start_time]].join(' ') event.end_time = [params[:end_date], params[:end_time]].join(' ') event..reload # Reload the #tags association because its members may have been modified when #tag_list was set above. attempt_save? end |