On 6 April 2012 10:01, phoe san <li...@ruby-forum.com> wrote:
> ...
>  def update
>
>    @user = User.find(params[:id])
>
>    @user.email = params[:user][:email]
>
>    @user.save
>
>
>      respond_to do |format|
>
>      if @user.save =  @user.update_attributes(params[:user])
>
>        if @user.update_attributes(params[:user])
>          format.html {redirect_to(profile_path(@user), :notice => 'User
> was successfully updated.')}
>        else
>          format.html { render action: "index" }
>        end
>      end
>  end
> ...........

You need to look through the update method and ask yourself what each
line is doing.  For example you seem to have two save calls and also
two update_attributes (which updates the object and saves it).  That
is four saves all together.  is that what you meant to do?

Then if it still does not work check in development.log to make sure
the action is being called with the correct parameters, then if still
not working debug into the update action to see what is going on.
Have a look at the Rails Guide on Debugging if you do not know how to
do that.

Colin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to