ruby on rails - CanCan is not allowing custom action/pages in Spree backend -
i have create new role in spree , limited cancan 1 controller. not allow access custom actions/pages.
create, delete, index etc
the above actions accessible, yet 'clean' view not.
controller -
def clean @handbags = spree::handbag.is_clean.page(params[:page]).per(50) end
abilitydecorator -
class abilitydecorator include cancan::ability def initialize(user) if user.respond_to?(:has_spree_role?) && user.has_spree_role?('technical') can :manage, spree::handbag end end end spree::ability.register_ability(abilitydecorator)
also tried -
can [:clean, :admin, :index etc..], spree::handbag
thanks help.
i got around overriding collection_actions , adding actions needed work -
def collection_actions [:index, :clean, :repair, :colour] end
Comments
Post a Comment