Hi Marnen, thanks I think that's great. The question is now will
CanCan Support that? Are you familiar with CanCan?
Something like... (ability.rb)
def initialize(user)
user ||= User.new
if user.role? :super_admin
.
.
end
user.rb
def role?(role)
return !!self.permission.find_by_name(role.to_s.camelize)
end
? That's the piece I can't put together.
thxs!
On Sep 14, 11:46 am, Marnen Laibow-Koser <[email protected]> wrote:
> radhames brito wrote:
> > role model is a gem that lets you add roles to the user as a method and
> > saves the role into a field on the user table as a bitmask
> > that is , lets say you have and array like this
>
> > ROLES = %w[admin moderator author banned]
>
> > this gord in your user model and you have a field in the user table
> > called roles_mask
>
> [...]
>
> Wow, what a bad idea. Remind me never to use that gem if that's really
> the way it works. Storing multiple values in one DB field (which is
> essentially what the bitmask is doing) is generally not a good thing.
>
> Best,
> --
> Marnen Laibow-Koserhttp://www.marnen.org
> [email protected]
> --
> Posted viahttp://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.