On 15.4.2005, at 05:53, Shane Sherman wrote:
> I have some pretty simple code that is updating a User object, but for
> some reason <at> user.update_attributes( <at>
params[''user'']) is
> returning false and not updating.
Can you try
@user.attributes = @params["user"]
if @user.save ...
and see if that works?
//jarkko
>
> What''s strange is that
<at>user.update_attribute("userid",
> <at>params[''user''][''userid''])
works fine for all the attributes i''m
> trying to update.
>
> I''ve tried just about everything I can think of, including
searching
> this list and I have absolutely no idea what I am doing wrong. Here is
> the my code for the Action and the View. All other database operations
> are working fine. This is using Postgresql on windows if it matters.
>
> def edit
> case <at>request.method
> when :get
> <at>user = User.find(<at>params[''id''])
> when :post
> <at>user = User.find(
<at>params[''user''][''id''])
>
> if <at>user.update_attributes(
<at>params[''user''])
> flash[''notice''] = ''User was successfully
updated.''
> redirect_to :action => ''admin'', :id =>
<at>user
> end
>
> end
> end
>
> my view source code is :
>
> <form action="../edit" method="POST">
> <%= hidden_field("user", "id") %>
> <p><b>Userid</b><br>
> <%= text_field("user", "userid", :size => 30)
%>
> </p>
> <p><b>E-mail</b><br>
> <%= text_field("user", "email", :size => 40)
%>
> </p>
> <input type="submit" value="Update" />
> </form>
>
> Does anyone have any ideas what I''m doing wrong?
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
--
Jarkko Laine
http://jlaine.net
http://odesign.fi
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails