Class: IshManager::EventsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- IshManager::EventsController
- Defined in:
- app/controllers/ish_manager/events_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'app/controllers/ish_manager/events_controller.rb', line 4 def create :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..join(', ')}." render 'new' end end |
#edit ⇒ Object
16 17 18 19 |
# File 'app/controllers/ish_manager/events_controller.rb', line 16 def edit :manage, Ish::Event @event = Ish::Event.find params[:id] end |
#index ⇒ Object
21 22 23 24 25 26 27 |
# File 'app/controllers/ish_manager/events_controller.rb', line 21 def index :manage, Ish::Event @events = Ish::Event.all if params[:q] @events = @events.where({ :name => /#{params[:q]}/i }) end end |
#new ⇒ Object
29 30 31 32 |
# File 'app/controllers/ish_manager/events_controller.rb', line 29 def new :manage, Ish::Event @event = Ish::Event.new end |
#show ⇒ Object
34 35 36 37 |
# File 'app/controllers/ish_manager/events_controller.rb', line 34 def show :manage, Ish::Event @event = Ish::Event.find params[:id] end |
#update ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/controllers/ish_manager/events_controller.rb', line 39 def update :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..join(', ')}." render 'edit' end end |