Sha256: 1410bee21a5e58f38ebfe4aeb90fa6c036c5afb0523121bc43788489c95cba2f

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

class PassTypesController < ArtfullyOseController
  requires_kit :passes

  def index
    @pass_types = current_organization.pass_types.includes(:passes).paginate(:page => params[:page], :per_page => 50)

    respond_to do |format|
      format.html

      format.csv do
        @filename = 'pass_types.csv'
        @csv_string = @pass_types.to_comma
        send_data @csv_string, :filename => @filename, :type => 'text/csv', :disposition => 'attachment'
      end
    end
  end

  def new
    @pass_type = PassType.new
  end

  def create
    @pass_type = PassType.new(params[:pass_type])
    @pass_type.organization = current_organization
    unless @pass_type.save
      flash[:error] = @pass_type.errors.full_messages.to_sentence
      render "new" and return
    end
    redirect_to pass_types_path
  end

  def edit
    @pass_type = current_user.current_organization.pass_types.where(:id => params[:id]).first
  end

  def update
    @pass_type = PassType.find(params[:id])
    @pass_type.update_attributes(params[:pass_type])
    flash[:notice] = "Your changes have been saved"
    redirect_to pass_types_path
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
artfully_ose-1.2.0.pre.23 app/controllers/pass_types_controller.rb