Class: AlarmsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- AlarmsController
- Defined in:
- lib/app/controllers/alarms_controller.rb
Overview
Experimental
begin
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
24 25 26 27 28 |
# File 'lib/app/controllers/alarms_controller.rb', line 24 def create @alarm = @base_model.alarms.create(params[:alarm]) flash[:notice] = "Alarm successfully created" if @alarm.save respond_with([@base_model, @alarm]) end |
#destroy ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/app/controllers/alarms_controller.rb', line 36 def destroy @alarm = @base_model.alarms.find(params[:id]) @alarm.destroy respond_to do |format| format.html { redirect_to([@base_model, @alarm]) } format.xml { head :ok } end end |
#edit ⇒ Object
20 21 22 |
# File 'lib/app/controllers/alarms_controller.rb', line 20 def edit respond_with(polymorphic_url([@base_model, (@alarm = @base_model.alarms.find(params[:id]))])) end |
#index ⇒ Object
7 8 9 10 |
# File 'lib/app/controllers/alarms_controller.rb', line 7 def index @alarms = @base_model.alarms.all respond_with(polymorphic_url(@base_model.class)) end |
#new ⇒ Object
16 17 18 |
# File 'lib/app/controllers/alarms_controller.rb', line 16 def new respond_with(polymorphic_url([@base_model, (@alarm = @base_model.alarms.new)])) end |
#show ⇒ Object
12 13 14 |
# File 'lib/app/controllers/alarms_controller.rb', line 12 def show respond_with(polymorphic_url([@base_model, (@alarm = @base_model.alarms.find(params[:id]))])) end |
#update ⇒ Object
30 31 32 33 34 |
# File 'lib/app/controllers/alarms_controller.rb', line 30 def update @alarm = @base_model.alarms.find(params[:id]) @alarm.update_attributes(params[:base_model]) respond_with(polymorphic_url([@base_model, @alarm])) end |