Sort of a Rails beginner here.. My application uses Devise for authentication. What I need it to do is allow users, once signed in, to create other users that belong to the same organization as him.
Problem is I can’t just use the default Devise new registration form since it doesn’t allow me to access it when I’m signed in (I’m thinking I can override this by generating my own User controller?).
Plus, the user table has an organization_id (automatically created on signup) and I need the form to pass the current_user.organization_id for organization_id, and the default form won’t let me do that.
Any suggestions?
You’ll have to create a custom form that’ll have all the required user fields and pass the form values to one of your controllers which will take the params something like this:
In addition to this you should secure this action with one of the
before_filterwhich will check if the user is currently logged in and able to create new users?Hope that helps.