Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Roles Select?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Shaun  
View profile  
 More options Jan 7 2011, 4:49 pm
From: Shaun <shaung...@gmail.com>
Date: Fri, 7 Jan 2011 13:49:09 -0800 (PST)
Local: Fri, Jan 7 2011 4:49 pm
Subject: Roles Select?
I have searched everywhere and tried to find an example of using ACL9
to generate a select form for use in a new user form.  Is there any
place that I can find an example of a view and controller that have a
"role select" implementation?

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kevin Monk  
View profile  
 More options Jan 8 2011, 11:37 am
From: Kevin Monk <ke...@mangoswiss.com>
Date: Sat, 8 Jan 2011 08:37:52 -0800 (PST)
Local: Sat, Jan 8 2011 11:37 am
Subject: Re: Roles Select?
I'm having the same issue except I'm wishing to use a check_box for
the roles.

At the moment I have something that looks a little like this...

- fields_for @user do |user_form|
  - user_form.fields_for :assign_roles do |role_form|
    - Role::POSSIBLE_ROLES.each do |role|
      %p
        = role_form.check_box role, :checked => @user.has_role?(role)
        = role_form.label role.humanize

but when I do this then in the params hash I get something like
this....

"assign_roles"=>{"super_administrator"=>"0", "administrator"=>"1"}

Was hoping I could use the standard @user.update_attributes by making
my filelds_for :roles

but that's not helping me too much.

Would be interested to know where you got to with it.

On Jan 7, 9:49 pm, Shaun <shaung...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Shaun Gish  
View profile  
 More options Jan 8 2011, 12:39 pm
From: Shaun Gish <sh...@figarointeractive.com>
Date: Sat, 8 Jan 2011 11:39:23 -0600
Local: Sat, Jan 8 2011 12:39 pm
Subject: Re: Roles Select?

Here's what I ended up doing:

http://rails.pastebin.com/N8V3QWjy

Basically I ended up defining a custom getter/setter... not sure if this is
the right way or best way to do it but it worked for me


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kevin Monk  
View profile  
 More options Jan 8 2011, 2:57 pm
From: Kevin Monk <ke...@mangoswiss.com>
Date: Sat, 8 Jan 2011 11:57:09 -0800 (PST)
Local: Sat, Jan 8 2011 2:57 pm
Subject: Re: Roles Select?
THanks Shaun.

The more I look at some of the other posts on here, the more I
realised that assigning multiple global roles to a single user
probably wasn't going to do me much good.

I ended up just changing to a single global role per user and then
creating make_admin and remove_admin routes and associated controller
actions and then only only allow access to those methods for admins.

It seems to be a recurring theme that if I've got stuck on something
it's normally because I have the structure a little skewy. Not always
easy to see where you're making a fundamental miscomprehension though
I guess.

On Jan 8, 5:39 pm, Shaun Gish <sh...@figarointeractive.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Shaun Gish  
View profile  
 More options Jan 8 2011, 3:14 pm
From: Shaun Gish <sh...@figarointeractive.com>
Date: Sat, 8 Jan 2011 14:14:45 -0600
Local: Sat, Jan 8 2011 3:14 pm
Subject: Re: Roles Select?

Yea... I'm kind of the same way...

Although it would be really nice if ACL9 had some sort of helper functions
for things like this... or even just a couple of examples to learn from.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »