Sha256: 08f2814ae5f1098aa0683d9fd60bc2215fcd43866dd14d141ed77d7a4fed368e
Contents?: true
Size: 1.17 KB
Versions: 1
Compression:
Stored size: 1.17 KB
Contents
class Eventable::EventsController < Eventable::EventableController before_filter :service_not_available, :unless => :enable_events_controller before_filter :get_events, :only => [:index] before_filter :get_event, :only => [:show, :edit, :update, :destroy] before_filter :new_event, :only => [:new, :create] def create if @event.update_attributes(params[:eventable_event]) flash[:notice] = 'Event was successfully created.' redirect_to(eventable_event_path(@event)) else render :action => "new" end end def update if @event.update_attributes(params[:eventable_event]) flash[:notice] = 'Event was successfully updated.' redirect_to(eventable_event_path(@event)) else render :action => "edit" end end def destroy @event.destroy redirect_to(eventable_events_path) end private def model event_model end def get_events @events = model.all end def get_event @event = model.find(params[:id]) end def new_event @event = model.new end def service_not_available raise "the events controller from the eventable gem should not be used except for debugging" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dcs-eventable-0.0.8 | app/controllers/eventable/events_controller.rb |