Any thoughts? Also worth noting that Video and Paintings inherit from Media. Media is an STI
On Oct 12, 9:07 pm, Christian Fazzini <[email protected]> wrote: > Small code typo. In VideoController#index. It should have been: > > <% if can? :update, video %> > <div class="interaction clearfix"> > <%= link_to 'edit', '#' %> > <%= link_to 'delete', '#', :class => 'last' %> > </div> > <% end %> > > On Oct 12, 9:05 pm, Christian Fazzini <[email protected]> > wrote: > > > By the way. I am using Devise, if that even matters > > > On Oct 12, 8:41 pm, Christian Fazzini <[email protected]> > > 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

