app/controllers/cms/page_routes_controller.rb in browsercms-3.5.7 vs app/controllers/cms/page_routes_controller.rb in browsercms-4.0.0.alpha
- old
+ new
@@ -1,47 +1,51 @@
module Cms
-class PageRoutesController < Cms::BaseController
-
- before_filter :load_page_route, :only => [:show, :edit, :update, :destroy]
- layout 'cms/administration'
-
- def index
- @page_routes = PageRoute.paginate(:order => "name", :page => params[:page])
- end
-
- def new
- @page_route = PageRoute.new
- end
-
- def create
- @page_route = PageRoute.new(params[:page_route])
- if @page_route.save
- flash[:notice] = "Page Route Created"
- redirect_to page_route_url(@page_route)
- else
- render :action => "new"
+ class PageRoutesController < Cms::BaseController
+
+ before_filter :load_page_route, :only => [:edit, :update, :destroy]
+
+ def index
+ @page_routes = PageRoute.paginate(:page => params[:page]).order("name")
end
- end
-
- def update
- if @page_route.update_attributes(params[:page_route])
- flash[:notice] = "Page Route Updated"
- redirect_to page_route_url(@page_route)
- else
- render :action => "new"
+
+ def new
+ @page_route = PageRoute.new
end
-
- end
-
- def destroy
- @page_route.destroy
- flash[:notice] = "Page Route Deleted"
- redirect_to page_routes_url
- end
-
- protected
+
+ def create
+ @page_route = PageRoute.new(page_route_params)
+ if @page_route.save
+ flash[:notice] = "Page Route Created"
+ redirect_to page_routes_path
+ else
+ render :action => "new"
+ end
+ end
+
+ def update
+ if @page_route.update(page_route_params)
+ flash[:notice] = "Page Route Updated"
+ redirect_to page_routes_path
+ else
+ render :action => "new"
+ end
+
+ end
+
+ def destroy
+ @page_route.destroy
+ flash[:notice] = "Page Route Deleted"
+ redirect_to page_routes_url
+ end
+
+ protected
def load_page_route
@page_route = PageRoute.find(params[:id])
end
-
-end
+
+ private
+ def page_route_params
+ params.require(:page_route).permit(Cms::PageRoute.permitted_params)
+ end
+
+ end
end
\ No newline at end of file