I have these tables...

ACCOUNTS
id
company_name

USERS
id
username
password
account_id (foreign key)


I have a create new user form. Each user is supposed to have an
account_id from an accounts table. Of course, on my user.rb model file I
have to validate for the presence of an account_id. How can I add the
account_id to the users table?

1) Maybe after logging in I store the account id on a session. Then,
when the user tries to add another user I grab it from the session?

2) Orrr... so I won't use a session, when the user tries to add another
user, I can query the user's row, get his account_id and then use it.

Which approach would work better?

Now, once I have the account id, how can I go about adding it at user
creation? At the users controller?

-- 
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 [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.

Reply via email to