ruby on rails - Admin content on frontend with cancancan and activeadmin administrator -


i'm using activeadmin gem administration , cancancan authorization.

i have problem admin authorization.

nomethoderror in illustreportscontroller#index

undefined method `admin?' #

end  if user.admin?     can :manage, :all end 

my ability.rb this

class ability   include cancan::ability    def initialize(user)      user ||= user.new # guest user (not logged in)      alias_action :create, :read, :update, :destroy, to: :crud      can [:read], illustreport      if user.id         can [:crud], illustreport, {user_id: user.id}     end      if user.admin?         can :manage, :all     end    end end 

and controller

class illustreportscontroller < applicationcontroller   load_and_authorize_resource 

i admin content on frontend.

i'm looking help. i'm beginner , can't find mistake. have test lot of things searching in google , stack i'm stopped. thank you time.


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -