Class: DependenciesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- DependenciesController
- Defined in:
- app/controllers/dependencies_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /dependencies POST /dependencies.xml.
-
#destroy ⇒ Object
DELETE /dependencies/1 DELETE /dependencies/1.xml.
-
#edit ⇒ Object
GET /dependencies/1/edit.
-
#index ⇒ Object
GET /dependencies.xml.
-
#new ⇒ Object
GET /dependencies/new GET /dependencies/new.xml.
-
#show ⇒ Object
GET /dependencies/1 GET /dependencies/1.xml.
-
#update ⇒ Object
PUT /dependencies/1 PUT /dependencies/1.xml.
Instance Method Details
#create ⇒ Object
POST /dependencies POST /dependencies.xml
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'app/controllers/dependencies_controller.rb', line 43 def create @dependency = Dependency.new(params[:dependency]) respond_to do |format| if @dependency.save flash[:notice] = 'Dependency was successfully created.' format.html { redirect_to(@dependency) } format.xml { render :xml => @dependency, :status => :created, :location => @dependency } else format.html { render :action => "new" } format.xml { render :xml => @dependency.errors, :status => :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /dependencies/1 DELETE /dependencies/1.xml
77 78 79 80 81 82 83 84 85 |
# File 'app/controllers/dependencies_controller.rb', line 77 def destroy @dependency = Dependency.find(params[:id]) @dependency.destroy respond_to do |format| format.html { redirect_to(dependencies_url) } format.xml { head :ok } end end |
#edit ⇒ Object
GET /dependencies/1/edit
37 38 39 |
# File 'app/controllers/dependencies_controller.rb', line 37 def edit @dependency = Dependency.find(params[:id]) end |
#index ⇒ Object
GET /dependencies.xml
5 6 7 8 9 10 11 12 |
# File 'app/controllers/dependencies_controller.rb', line 5 def index @dependencies = Dependency.find(:all) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @dependencies} end end |
#new ⇒ Object
GET /dependencies/new GET /dependencies/new.xml
27 28 29 30 31 32 33 34 |
# File 'app/controllers/dependencies_controller.rb', line 27 def new @dependency = Dependency.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @dependency } end end |
#show ⇒ Object
GET /dependencies/1 GET /dependencies/1.xml
16 17 18 19 20 21 22 23 |
# File 'app/controllers/dependencies_controller.rb', line 16 def show @dependency = Dependency.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @dependency, :include => [:dependency_conditions] } end end |
#update ⇒ Object
PUT /dependencies/1 PUT /dependencies/1.xml
60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'app/controllers/dependencies_controller.rb', line 60 def update @dependency = Dependency.find(params[:id]) respond_to do |format| if @dependency.update_attributes(params[:dependency]) flash[:notice] = 'Dependency was successfully updated.' format.html { redirect_to(@dependency) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @dependency.errors, :status => :unprocessable_entity } end end end |