Class: Spree::Transit::ServiceCalendarsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/spree/transit/service_calendars_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#current_vendor, #edit_object_url, #page, #per_page, #required_vendor_user!, #vendors

Instance Method Details

#location_after_saveObject



25
26
27
# File 'app/controllers/spree/transit/service_calendars_controller.rb', line 25

def location_after_save
  transit_vendor_service_calendars_url
end

#update_statusObject



12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/spree/transit/service_calendars_controller.rb', line 12

def update_status
  if @object.update(active: !@object.active)
    flash[:success] = flash_message_for(@object, :successfully_updated)
  else
    flash[:error] = @object.errors.full_messages.to_sentence
  end

  redirect_to transit_vendor_service_calendars_url
rescue ActiveRecord::RecordInvalid => e
  flash[:error] = e.message
  redirect_to transit_vendor_service_calendars_url
end