Skip to content
Browse files

descreace flog count for PagesController#update and #create actions

  • Loading branch information...
1 parent 1473255 commit 9911a664238528bb2d31e18af493f6052a27642f @ck3g committed
Showing with 6 additions and 9 deletions.
  1. +6 −9 app/controllers/pages_controller.rb
View
15 app/controllers/pages_controller.rb
@@ -1,6 +1,8 @@
class PagesController < ApplicationController
authorize_resource
+ respond_to :html
+
before_filter :find_page, only: [:edit, :update, :destroy]
def index
@@ -18,11 +20,8 @@ def new
def create
@page = Page.new params[:page]
- if @page.save
- redirect_to pages_path, notice: t(:created_successfully)
- else
- render :new
- end
+ flash[:notice] = t(:created_successfully) if @page.save
+ respond_with @page, location: pages_path
end
def edit
@@ -30,11 +29,9 @@ def edit
def update
if @page.update_attributes params[:page]
- @page.reload
- redirect_to pages_path, notice: t(:updated_successfully)
- else
- render :edit
+ flash[:notice] = t(:updated_successfully)
end
+ respond_with @page, location: pages_path
end
def destroy

0 comments on commit 9911a66

Please sign in to comment.
Something went wrong with that request. Please try again.