Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby on Rails: CanCan and static pages

I am using CanCan 2.0 gem for authorization and high_voltage gem for static pages.

In my routes.rb file I have:

match 'about' => 'high_voltage/pages#show', id: 'about'

And I want to make it public in my ability.rb file, but none of these two lines do that:

can :read, :pages
can :read, 'high_voltage/pages'

How do I fix this?

like image 789
krn Avatar asked Nov 26 '22 01:11

krn


1 Answers

Isn't this problem related to the fact that there is no model 'Page'? There is cancan wiki, how to deal with this situation: it should work when you add

authorize_resource :class => false

to your controller.

like image 99
santuxus Avatar answered Nov 27 '22 14:11

santuxus