Correct me if I'm wrong here, but it sounds like companies won't be logging in — only users, which belong to a company.
Up vote 3 down vote favorite 1 share g+ share fb share tw.
I have a created a devise for Companies. I have made a table users, wish I want to store the user information password etc.. When a user sign up I want it to create a new user and a association to the Company. My Company model: has_one: User My User model: Belongs_to: Company How should I overwrite the registration controller?
Best regards, Rails beginner authentication ruby-on-rails-3 devise link|improve this question edited Jan 26 '11 at 19:44ergosys7,10721029 asked Jan 3 '11 at 12:18Rails beginner162.
Correct me if I'm wrong here, but it sounds like companies won't be logging in — only users, which belong to a company. With that in mind, you should have User as the Devise model instead of Company. Your associations, then, are correct.
The next step would be to add fields for the user in the form for company#new using nested attributes (fields_for in the view; accepts_nested_attributes_for in the model). Answering your original question: you can use nested attributes to create a new user in the sign up form. You wouldn't need to override Devise's registration controller.
Just modify the sign up form to include fields_for a user. Also, make sure the Company model has accepts_nested_attributes_for for the User model. A quick aside: I'm not aware of the architecture of your application, but it seems like a has_many would be more appropriate.
In cases similar to this, it's far more likely that you'll want to have multiple users belonging to a single company.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.