Not able to update user account table

I am getting username, password and displayname during account signup
and i am putting these values in user table. I have one more table
‘userprofile’ which is used for storing firstname, lastname and other
personal details.

I want to update these personal details and displayname(which is in user
table)from ONE particular page. I can able to update personal details
but not ‘displayname’

my controller for updating the form values is given below:

  usPrid = params[:userprofile][:id]
  dname = params[:displayname]
 usPr = Userprofile.find(usPrid)
 usPr.update_attributes(params[:userprofile])
 userdn = User.find(usPr.user_id)
 userdn.displayname = dname
 userdn.save

Can you please tell me why that ‘displayname’ is not getting updated?
am i missing some thing? or Is there any restrictions in updating user
account table?

Thanks in advance.

Regards

i believe its because your not associating a userdn object to your form
for

params[:displayname]?

have you print out params[:displayname]?

do this

logger.debug “display name” + params[:displayname]

Ruby Q. wrote:

I am getting username, password and displayname during account signup
and i am putting these values in user table. I have one more table
‘userprofile’ which is used for storing firstname, lastname and other
personal details.

I want to update these personal details and displayname(which is in user
table)from ONE particular page. I can able to update personal details
but not ‘displayname’

my controller for updating the form values is given below:

  usPrid = params[:userprofile][:id]
  dname = params[:displayname]
 usPr = Userprofile.find(usPrid)
 usPr.update_attributes(params[:userprofile])
 userdn = User.find(usPr.user_id)
 userdn.displayname = dname
 userdn.save

Can you please tell me why that ‘displayname’ is not getting updated?
am i missing some thing? or Is there any restrictions in updating user
account table?

Thanks in advance.

Regards

Hi Koloa,

Thanks for your reply.

I have associated my userdn object with displayname. See my 2nd line 

and 6th line of the controller code.

    dname = params[:displayname]
    userdn.displayname = dname

development.log file also shows the correct value before assigning and
after assigning new value. So there is no issues up to 6th line in my
controller. but this userdn.save is not working…

Regards
Rubyquest

koloa wrote:

i believe its because your not associating a userdn object to your form
for

params[:displayname]?

have you print out params[:displayname]?

do this

logger.debug “display name” + params[:displayname]

oh, i had an issue like this before when i was associating a model that
has_one picture.

i had to do a myModel.build_mypituretable(params[:uploadfield])

so maybe you may have to do something similiar?

Ruby Q. wrote:

Hi Koloa,

Thanks for your reply.

I have associated my userdn object with displayname. See my 2nd line 

and 6th line of the controller code.

    dname = params[:displayname]
    userdn.displayname = dname

development.log file also shows the correct value before assigning and
after assigning new value. So there is no issues up to 6th line in my
controller. but this userdn.save is not working…

Regards
Rubyquest

koloa wrote:

i believe its because your not associating a userdn object to your form
for

params[:displayname]?

have you print out params[:displayname]?

do this

logger.debug “display name” + params[:displayname]