Class: ServicesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- ServicesController
- Defined in:
- app/controllers/services_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/services_controller.rb', line 16 def create @service = Service.new(params[:service]) if @service.save flash[:notice] = 'Successfully created service.' redirect_to @service else render :action => 'new' end end |
#destroy ⇒ Object
40 41 42 43 44 45 |
# File 'app/controllers/services_controller.rb', line 40 def destroy @service = Service.find(params[:id]) @service.destroy flash[:notice] = 'Successfully destroyed service.' redirect_to services_url end |
#edit ⇒ Object
26 27 28 |
# File 'app/controllers/services_controller.rb', line 26 def edit @service = Service.find(params[:id]) end |
#index ⇒ Object
4 5 6 |
# File 'app/controllers/services_controller.rb', line 4 def index @services = Service.all end |
#new ⇒ Object
12 13 14 |
# File 'app/controllers/services_controller.rb', line 12 def new @service = Service.new end |
#show ⇒ Object
8 9 10 |
# File 'app/controllers/services_controller.rb', line 8 def show @service = Service.find(params[:id]) end |
#update ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/services_controller.rb', line 30 def update @service = Service.find(params[:id]) if @service.update_attributes(params[:service]) flash[:notice] = 'Successfully updated service.' redirect_to @service else render :action => 'edit' end end |