> if @sample.update_attributes(params[:sample])
> flash[:notice] = 'Sample was successfully updated.'
> respond_to do |format|
> format.html {redirect_to(@sample)}
> format.js
> end
> else
> render :action => "edit"
> end
Oops, I take this back. It should be more like:
# PUT /people/1
# PUT /people/1.xml
def update
@person = Person.find(params[:id])
respond_to do |format|
if @person.update_attributes(params[:person])
flash[:notice] = 'Person was successfully updated.'
format.html { redirect_to(@person) }
format.js
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @person.errors, :status =>
:unprocessable_entity }
end
end
end
I don't know where my head was on that previous post. Sorry about
that...
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---