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