Fixed: unable to find policy AdvisoriesPolicy

This commit is contained in:
Vokhmin Alexey V 2015-06-05 23:55:55 +03:00
parent e7c07897e8
commit 498f724986
3 changed files with 10 additions and 5 deletions

View File

@ -41,13 +41,13 @@ ActiveAdmin.register User do
f.actions f.actions
end end
action_item(:show) do action_item(:reset_token, only: :show) do
link_to 'Reset token', reset_token_admin_user_path(resource), link_to 'Reset token', reset_token_admin_user_path(resource),
'data-method' => :put, 'data-method' => :put,
data: { confirm: 'Are you sure you want to reset token?' } data: { confirm: 'Are you sure you want to reset token?' }
end end
action_item(:show) do action_item(:login_as, only: :show) do
link_to 'Login as user', login_as_admin_user_path(resource) link_to 'Login as user', login_as_admin_user_path(resource)
end end

View File

@ -3,8 +3,8 @@ class AdvisoriesController < ApplicationController
skip_before_action :authenticate_user! if APP_CONFIG['anonymous_access'] skip_before_action :authenticate_user! if APP_CONFIG['anonymous_access']
def index def index
authorize :advisories authorize :advisory
@advisories = Advisory.includes(:platforms).search(params[:q]).uniq @advisories = Advisory.includes(:platforms, :projects).search(params[:q]).uniq
@advisories_count = @advisories.count @advisories_count = @advisories.count
@advisories = @advisories.paginate(page: current_page, per_page: Advisory.per_page) @advisories = @advisories.paginate(page: current_page, per_page: Advisory.per_page)
respond_to do |format| respond_to do |format|
@ -20,7 +20,7 @@ class AdvisoriesController < ApplicationController
end end
def search def search
authorize :advisories authorize :advisory
@advisory = Advisory.by_update_type(params[:bl_type]).search_by_id(params[:query]).first @advisory = Advisory.by_update_type(params[:bl_type]).search_by_id(params[:query]).first
if @advisory.nil? if @advisory.nil?
render nothing: true, status: 404 render nothing: true, status: 404

View File

@ -6,5 +6,10 @@ describe AdvisoriesController, type: :controller do
get :search get :search
expect(response).to_not redirect_to(forbidden_path) expect(response).to_not redirect_to(forbidden_path)
end end
it "should be able to perform index action" do
get :index
expect(response).to be_success
end
end end
end end