Simple CanCan problem
Posted
by
sscirrus
on Stack Overflow
See other posts from Stack Overflow
or by sscirrus
Published on 2011-01-07T19:51:31Z
Indexed on
2011/01/07
20:54 UTC
Read the original article
Hit count: 277
I have just started with CanCan and here's a sample of the code:
# Ability.rb
def initialize(user)
user ||= User.new
can :read, Link
end
# view.html.erb
<% if can? :read, @link %>
...
<% end %>
This is from the github repo for CanCan but this doesn't seem to work (it returns false and stops the ...
code from running).
When I change the view to <% if can? :read, Link %>
, it works. But, this is different to the CanCan readme. Do you know where I'm going wrong here?
© Stack Overflow or respective owner