Sha256: 9a0e166ddf493f33e3a149d866602cc8d9d1c31b91a08a6c4e8bc61f9379437b

Contents?: true

Size: 1.19 KB

Versions: 91

Compression:

Stored size: 1.19 KB

Contents

class IshManager::EventsController < ::IshManager::ApplicationController

  def create
    authorize! :manage, Ish::Event
    @event = Ish::Event.create( params[:event].permit! )
    if @event.persisted?
      flash[:notice] = "Success."
      redirect_to action: 'index'
    else
      flash[:alert] = "No luck: #{@event.errors.full_messages.join(', ')}."
      render 'new'
    end
  end

  def edit
    authorize! :manage, Ish::Event
    @event = Ish::Event.find params[:id]
  end

  def index
    authorize! :manage, Ish::Event
    @events = Ish::Event.all.order_by({ start_at: :desc })
    if params[:q]
      @events = @events.where({ :name => /#{params[:q]}/i })
    end
  end

  def new
    authorize! :manage, Ish::Event
    @event = Ish::Event.new
  end

  def show
    authorize! :manage, Ish::Event
    @event = Ish::Event.find params[:id]
  end

  def update
    authorize! :manage, Ish::Event
    @event = Ish::Event.find params[:id]
    @event.update_attributes( params[:event].permit! )
    if @event.persisted?
      flash[:notice] = "Success."
      redirect_to action: 'index'
    else
      flash[:alert] = "No luck: #{@event.errors.full_messages.join(', ')}."
      render 'edit'
    end
  end

end

Version data entries

91 entries across 91 versions & 1 rubygems

Version Path
ish_manager-0.1.8.513 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.512 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.511 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.510 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.509 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.508 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.507 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.506 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.505 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.504 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.503 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.500 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.499 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.498 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.497 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.496 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.495 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.494 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.493 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.492 app/controllers/ish_manager/events_controller.rb