Sha256: df50e7356e7e59e6d26a661261e013eb6bd20725cd1ac0afd841ffbb44b62038

Contents?: true

Size: 1.16 KB

Versions: 23

Compression:

Stored size: 1.16 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
    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

23 entries across 23 versions & 1 rubygems

Version Path
ish_manager-0.1.8.420 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.419 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.418 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.417 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.416 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.415 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.414 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.413 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.412 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.411 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.410 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.409 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.408 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.407 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.406 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.405 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.404 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.403 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.402 app/controllers/ish_manager/events_controller.rb
ish_manager-0.1.8.401 app/controllers/ish_manager/events_controller.rb