Newby (how to save information of two tables in a single dat

Hello,

 I'm very new on rails, I discovered it last week so, sorry if my

question are stupid, I am wainting for some books on rails, read some
documentation but can’t solve this problems.

I imported gem for autenticate account (signup, login, logout) but

I want to extend it so the user fills some important information that
will be stored in other table rather than users, this is the table
company, when the user creates their account, a company would be
created.

So I modify the rhtml of the view, include some fields of the
company table, an in the controller user in signup method

 def signup
                @user = User.new

I inserted this line
@company = Company.new

also in def create
@company = Company.new(params[:firm])
@user = User.new(params[:user])
end

The form inserts the data for user, but not for company, any idea how
to accomplish this?

Thank you

@company = Company.new(params[:company])

@company = Company.new(params[:company])

Sorry, the line is like you mentioned

@company = Company.new(params[:company])

and it just insert data in one table

Any other idea?

Mike wrote:

Sorry, the line is like you mentioned

@company = Company.new(params[:company])

and it just insert data in one table

AnotherTable.create!(params[:another_table])

?


Phlip
Redirecting... ← NOT a blog!!!