Hi
I am trying to overcome the learning curve of RoR.
I installed the login_generator and made some sample
app that use authentication. So far so good.
Now I want to write a signup where the form refers to
2 different objects: user and firm.
I have the following models in place:
class User < ActiveRecord::Base
belongs_to :firm
...
The users table has a ''firm_id'' field
class Firm < ActiveRecord::Base
has_many :users
The account controller:
def signup
@firm = Firm.new(@params[:firm])
@user = User.new(@params[:user])
if @request.post? and @firm.save
@session[:user] = User.authenticate(@user.login,
@params[:user][:password])
flash[''notice''] = "Signup successful"
redirect_back_or_default :action => "welcome"
end
end
I was under the impression that saving the parent
(firm) would automatically save the child with the
@firm.save command.
It only saves the firm though; user stays blank...
What am I doing wrong?
-- PC
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com