app/controllers/effective/pages_controller.rb in effective_pages-1.3.2 vs app/controllers/effective/pages_controller.rb in effective_pages-2.0.0
- old
+ new
@@ -4,14 +4,17 @@
@pages = Effective::Page.all
@pages = @pages.published unless (params[:edit] || params[:preview])
@page = @pages.find(params[:id])
- EffectiveResources.authorize!(self, :show, @page)
+ raise ActiveRecord::RecordNotFound unless @page.present? # Incase .find() isn't raising it
+ raise Effective::AccessDenied.new('Access Denied', :show, @page) unless @page.roles_permit?(current_user)
+ EffectivePages.authorized?(self, :show, @page)
+
@page_title = @page.title
@meta_description = @page.meta_description
- render @page.template, :layout => @page.layout, :locals => {:page => @page}
+ render @page.template, layout: @page.layout, locals: { page: @page }
end
end
end