My saves are failing me and I can’t figure out why.
I am trying to save an address id to a user object just after I create
This isn’t the exact code, but it shows what I am trying to do.
class AddressesController < ApplicationController
@address = Address.new(params[:address])
saved_address = @address.save
@user = User.find(params[:id]) @user.address_id = @address.id saved_user = @user.save end
User.save keeps on returning false.
Any ideas why? I can access different attributes of the user, so I know
that the proper user is getting returned from the find.
In my user class I have attr_accessible :address_id so I should be able
to access it, shouldn’t I?