I have the following in my ability.rb file:
can :create, ThreadParticipation do |participation|
Rails.logger.info 'XXXXXXX'
end
What's strange is that when I call ThreadParticipation.new, that rule is rulling and I'm seeing t开发者_Python百科he logger output?
Why would can :create run when I'm just doing .new
Thanks
create is an alias for the actions new + create. This has been to done to simulate C-R-U-D behaviour. So,
:create = :new + :create
:read = :index + :show
:update = :edit + :update
:destroy = :destroy
Also,
:manage = :create + :read + :update + :destroy
精彩评论