I have problem to update personaldata accessing with/from @user.
''@debug @user'' shows that @user.personaldata attributes are
properlly
modified, but ''@user.save'' saves only table users but not
personaldatas
Is a problem with my associations? How to save personaldata with
@user.save ?
class User < ActiveRecord::Base
has_one :personaldata
end
class Personaldata < ActiveRecord::Base
belongs_to :user
end
class UserController < ApplicationController
def update
@user = User.find_by_username(params[:id], :include =>
[:personaldata])
@user.attributes = params[:personaldata] # <- doesn''t work
#@user.personaldata.attributes = params[:personaldata] # <- this way
it doesn''to work too
if @user.save
flash[:notice] = ''Updated''
redirect_to :action => ''list''
else
render :action => ''new''
end
end
end
--
Posted via http://www.ruby-forum.com/.