El 21 de abril de 2010 22:54, Diego Soreira <[email protected]>escribió:
> Les paso el Código... Gracias!
>
> ###########Controller###########
> def update
> @user = User.find(params[:id])
>
> respond_to do |format|
> if @user.update_attributes(params[:company])
> flash[:notice] = 'Company was successfully updated.'
> format.html { redirect_to(@user) }
> (:controller => '/account', :action => 'index')
> format.xml { head :ok }
> else
> format.html { render :action => "edit" }
> format.xml { render :xml => @user.errors, :status =>
> :unprocessable_entity }
> end
> end
> end
>
> ##########View###############
>
> <%= error_messages_for :user %>
> <% form_for :user do |f| -%>
> <p><label for="login">Login</label><br/>
> <%= f.text_field :login %></p>
>
> <p><label for="email">Email</label><br/>
> <%= f.text_field :email %></p>
>
> <p><label for="password">Password</label><br/>
> <%= f.password_field :password %></p>
>
> <p><label for="password_confirmation">Confirm Password</label><br/>
> <%= f.password_field :password_confirmation %></p>
>
> <p><%= f.submit 'Update' %></p>
> <% end -%>
>
> <% form_for :story do |f| %>
> <p>
> description:<br />
> <%= f.text_area :description %>
> </p>
> <p><%= submit_tag %></p>
> <% end %>
>
> ###################################################################
>
>
Probá reemplazando tu metodo update en el controller con esto:
def update
@user = User.find(params[:id])
if @user.update_attributes(params[:company])
flash[:notice] = 'User was successfully updated.'
redirect_to user_path(@user)
else
flash[:error] = 'User was not updated!'
render :action => "edit"
end
end
_______________________________________________
Ruby mailing list
[email protected]
http://lista.rubyargentina.com.ar/listinfo.cgi/ruby-rubyargentina.com.ar