By the way. I am using Devise, if that even matters On Oct 12, 8:41 pm, Christian Fazzini <christian.fazz...@gmail.com> wrote: > What am I doing wrong here? I am using cancan on Rails 3. In my > Ability class, I've got: > > class Ability > include CanCan::Ability > > def initialize(user) > user ||= User.new # guest user, for users who are not registered > or don't have an account yet > > if user.role? :admin > can :manage, :all > elsif user.role? :artist > can :read, [Artist, Painting, Video] > can :manage, Video do |video| > video.try(:user) == user > end > else > can :create, [Artist] > can :read, :all > end > end > end > > In VideosController#index, I have: > > <% if can? :update, song %> > <div class="interaction clearfix"> > <%= link_to 'edit', '#' %> > <%= link_to 'delete', '#', :class => 'last' %> > </div> > <% end %> > > I get: > > undefined method `user' for :index:Symbol
-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.