Skip to content

CanTango uses :roles_list for the has_method instead of as the list_method #26

Open
@pcmantz

Description

Here is my config/initializers/cantango.rb:

CanTango.config do |config|

  config.debug.set :on

  config.engine(:permit).set :on
  config.permits.disable :user, :account, :special, :role_group

  config.engine(:permission).set :off
  config.engine(:cache).set :off

  # config.enable_helpers :rest
end

And here is what I'm seeing in pry:

pry main:/Users/pcmantz/git/vamp-api $ pp CanTango::config.roles
#<CanTango::Configuration::Roles:0x007fbac65c2910
 @excluded=[],
 @has_method=:roles_list,
 @list_method=:roles_list,
 @onlies=[],
 @role_system=:simple_roles,
 @roles_list_map=
  {:troles=>{:list=>:role_list}, :simple_roles=>{:list=>:roles_list}}>
=> #<CanTango::Configuration::Roles:0x007fbac65c2910
 @excluded=[],
 @has_method=:roles_list,
 @list_method=:roles_list,
 @onlies=[],
 @role_system=:simple_roles,
 @roles_list_map=
  {:troles=>{:list=>:role_list}, :simple_roles=>{:list=>:roles_list}}>
pry main:/Users/pcmantz/git/vamp-api $ pp CanTango::config.roles.has_method
:roles_list
=> :roles_list

I'm using my own role system (which I assume looks like the has_many simple_roles system).

I'm able to fix this with the following addition to my config/initializers/cantango.rb file:

  config.roles.list_method = :roles_list
  config.roles.has_method  = :has_role?

As I didn't have any luck configuring my custom role system.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions