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