Home:ALL Converter>rails 3 can can ability

rails 3 can can ability

Ask Time:2014-09-08T17:53:10         Author:Siva KB

Json Formatter

I am using can can gem to restriction user based on role there is no model for product

class ProductsController < ApplicationController
    authorize_resource :class => false

   def index
     @customers=Customer.all
   end
end

in ability.rb

when i write like this can can allow me to acess the product controller

can [:index], :product

but when i write like this

can [:index], :products

it doesnot allow me to acess the product controller

my doubt is the controller name is products but in ability why we need to write product
and it's possibility to write plural in ability.rb ?

Thanks in advance

Author:Siva KB,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/25721556/rails-3-can-can-ability
yy