diff --git a/app/controllers/breweries_controller.rb b/app/controllers/breweries_controller.rb index c7a7b6d..73c35dc 100644 --- a/app/controllers/breweries_controller.rb +++ b/app/controllers/breweries_controller.rb @@ -57,9 +57,9 @@ class BreweriesController < ApplicationController # PUT /breweries/1 # PUT /breweries/1.xml def update + @page.attributes = params[:page] + @brewery.attributes = params[:brewery] respond_to do |format| - @page.attributes = params[:page] - @brewery.attributes = params[:brewery] if @brewery.save flash[:notice] = 'Brewery was successfully updated.' format.html { redirect_to brewery_url(@brewery.page.title_for_url) } diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index a25e81f..42365f6 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -51,8 +51,9 @@ class PagesController < ApplicationController # PUT /pages/1 # PUT /pages/1.xml def update + @page.attributes = params[:page] respond_to do |format| - if @page.update_attributes(params[:page]) + if @page.save flash[:notice] = 'Page was successfully updated.' format.html { redirect_to page_url({ :id => @page.title_for_url }) } format.xml { head :ok } @@ -67,7 +68,6 @@ class PagesController < ApplicationController # DELETE /pages/1.xml def destroy @page.destroy - respond_to do |format| format.html { redirect_to pages_url } format.xml { head :ok }