On Oct 20, 2010, at 11:36 PM, Leonel *.* wrote:
Your Accounts will have usernames and e-mail addresses? Why?
Those properly belong to Users.
Am I misunderstanding?
Yes, a little bit :P Like I said above...
"The user that signs up and creates the account is the admin user for
the
account. Then, he can send email invitations to his staff (users) to
also use the application."
You really want to use Devise and Devise Invitable for this. You just
described the last site I built with this combination EXACTLY, and the
one before that almost the same (restricted invitations to members of
the Sales team). There is one User model, with Devise and Invitable in
it. Practices (it's a medical device site) are validated to have a
unique name. The first User to register a Practice becomes its owner,
and can then access the invitation page to send keys to other people
by entering their e-mail address. But I didn't have to make any extra
controllers for this, just follow the fall-line of the Devise and
invitable instructions. When I wanted additional fields in my
database, I just rolled a new migration and modified the views.
Everything else was taken care of for me.
Walter
Account has many Users
User belongs to Account
Think of the Account class as a Company class or a Business class. The
users belong to the Account, Business or Company (whatever you want to
call it). Let's say the account is like the company, and it contains
address, website, phone, fax.
So when somebody opens up an account using the sign up form it fills
out
fields like this:
*First name (User class)
*Last name (User class)
*Company (Account class)
*Username (User class)
*Password (User class)
*Application Address http://______.application.com (Account class)
So I created a Signup controller. When submitting the sign up form,
both
an Account object and an User object have to be created. Since User
belongs to Account. The newly created account.id has to be entered in
user.account_id
That's why I'm saying that I have to create an Account and a User
using
the same controller and reference the User to the Account.
Also built in.
You can add Devise to an existing model, and it just works. Or use
the
devise generator to make a new model with all the trimmings.
For sure will take a look at it tomorrow early morning :D
Thanks
--
Posted via http://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 rubyonrails-
[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
.
--
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.