def edit
@item = Item.find(params[:id])
redirect_to :action=>:list if (request.post? and
@item.update_attributes(params[:item]))
end
I could probably condense it into one line (something like
...and(@item=Item.update...)), but I''ll probably actually use:
def edit
@item = Item.find(params[:id])
if request.post? and @item.update_attributes(params[:item])
flash[:notice] = ''Item updated.''
redirect_to :action=>:list
end
end
I like this readable conciseness that''s easily possible in Ruby/Rails.
:)
Joe
--
Posted via http://www.ruby-forum.com/.