I’ve got a user model and an address model; a user has_many addresses.
A user object can be created via an html form which also allows for an
initial address to be created.
I’ve got a controller method working to save both objects via the
form, but I suspect I can achieve this in a more rails-esque manner.
Here is my controller method:
@user = User.new(params[:user])
@address = Address.new(params[:address])
return unless request.post?
@address.user_id = @user.id
flash[:notice_good] = “Your account needs to be now be
activated. You have been sent a confirmation email with activation
redirect_to :controller => “/shop”, :action => “index”
Maybe this is OK, but any clues would be appreciated.