Class: SummerResidents::BungalowsController
- Inherits:
-
SummerResidentsController
- Object
- ApplicationController
- SummerResidentsController
- SummerResidents::BungalowsController
- Defined in:
- app/controllers/summer_residents/bungalows_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /bungalows POST /bungalows.json.
-
#destroy ⇒ Object
DELETE /bungalows/1 DELETE /bungalows/1.json.
-
#edit ⇒ Object
GET /bungalows/1/edit.
-
#new ⇒ Object
GET /bungalows/new GET /bungalows/new.json.
-
#update ⇒ Object
PUT /bungalows/1 PUT /bungalows/1.json.
Instance Method Details
#create ⇒ Object
POST /bungalows POST /bungalows.json
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/summer_residents/bungalows_controller.rb', line 21 def create mass_assign Bungalow respond_to do |format| if @bungalow.save format.html { redirect_to @bungalow, :notice => 'Bungalow was successfully created.' } format.json { render :json => @bungalow, :status => :created, :location => @bungalow } else format.html { render :action => "new" } format.json { render :json => @bungalow.errors, :status => :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /bungalows/1 DELETE /bungalows/1.json
53 54 55 56 57 58 59 |
# File 'app/controllers/summer_residents/bungalows_controller.rb', line 53 def destroy Bungalow.find(params[:id]).destroy respond_to do |format| format.js { render nothing: true } end end |
#edit ⇒ Object
GET /bungalows/1/edit
15 16 17 |
# File 'app/controllers/summer_residents/bungalows_controller.rb', line 15 def edit @bungalow = Bungalow.find(params[:id]) end |
#new ⇒ Object
GET /bungalows/new GET /bungalows/new.json
5 6 7 8 9 10 11 12 |
# File 'app/controllers/summer_residents/bungalows_controller.rb', line 5 def new @bungalow = Bungalow.new respond_to do |format| format.html # new.html.erb format.json { render :json => @bungalow } end end |
#update ⇒ Object
PUT /bungalows/1 PUT /bungalows/1.json
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/controllers/summer_residents/bungalows_controller.rb', line 37 def update mass_assign Bungalow respond_to do |format| if @bungalow.save format.html { redirect_to @bungalow, :notice => 'Bungalow was successfully updated.' } format.json { head :no_content } else format.html { render :action => "edit" } format.json { render :json => @bungalow.errors, :status => :unprocessable_entity } end end end |