Class: TicketTypesController
- Inherits:
-
ArtfullyOseController
- Object
- ActionController::Base
- ArtfullyOseController
- TicketTypesController
- Defined in:
- app/controllers/ticket_types_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/ticket_types_controller.rb', line 9 def create params[:ticket_type][:price] = TicketType.price_to_cents(params[:ticket_type][:price]) @ticket_type = @section.ticket_types.build(params[:ticket_type].except!("section_id")) @ticket_type.show = @section.chart.show if @ticket_type.save flash[:notice] = "Your ticket type has been saved" else flash[:error] = "We couldn't save your ticket type because " + @section.errors..to_sentence end redirect_to event_show_path(@section.chart.show.event, @section.chart.show) end |
#edit ⇒ Object
22 23 24 25 |
# File 'app/controllers/ticket_types_controller.rb', line 22 def edit @ticket_type = TicketType.find(params[:id]) render :layout => false end |
#new ⇒ Object
4 5 6 7 |
# File 'app/controllers/ticket_types_controller.rb', line 4 def new @ticket_type = @section.ticket_types.build render :layout => false end |
#update ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'app/controllers/ticket_types_controller.rb', line 27 def update @ticket_type = TicketType.find(params[:id]) @show = @ticket_type.show :manage, @show params[:ticket_type][:price] = TicketType.price_to_cents(params[:ticket_type][:price]) @ticket_type.update_attributes(params[:ticket_type]) redirect_to event_show_path(@show.event, @show) end |