Sha256: 915dfac8b449371ca7b2c46f4e6f51112def321d8a32079c3ddfebed7956a4d9

Contents?: true

Size: 808 Bytes

Versions: 1

Compression:

Stored size: 808 Bytes

Contents

class Eventable::PricelistsController < Eventable::EventableController

  before_filter :get_event
  before_filter :get_pricelist

  def show
    @new_price = @event.prices.build
    try_after_callback
  end

  def edit
    # you can add a blank/new item like this:
    @pricelist.add_blank
    try_after_callback
  end

  def update
    if @pricelist.update_attributes(params[:eventable_pricelist])
      try_after_callback do
        flash[:notice] = 'Prices were successfully updated.'
        redirect_to(eventable_event_pricelist_path(@event))
      end
    else
      try_after_callback :fail do
        render :action => "edit"
      end
    end
  end

  private

  def get_event
    @event = event_model.find(params[:event_id])
  end

  def get_pricelist
    @pricelist = @event.pricelist
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dcs-eventable-0.0.8 app/controllers/eventable/pricelists_controller.rb