ruby on rails - Finding all roles for a particular resource instance in Rolify -
how find roles particular resource instance in rolify? documentation suggests following:
forum.find_roles # => [ list of roles binded forum instance or forum class ]
but if want particular forum
instance? forum.first.find_roles
not work. there way? tried location
instead of forum
:
2.1.5 :003 > location.first.find_roles location load (0.3ms) select "locations".* "locations" order "locations"."id" asc limit 1 nomethoderror: undefined method `find_roles' #<location:0x007fbe880d1b48> /users/scott/.rvm/gems/ruby-2.1.5@rails4/gems/activemodel-4.2.1/lib/active_model/attribute_methods.rb:433:in `method_missing' ... ... ...
location.first.roles
should work.
reference: https://github.com/rolifycommunity/rolify#instance-level
Comments
Post a Comment