The edit action is:
def edit
@title = "Pinnacle Harvest: Edit Vendor"
@vendor = Vendor.find(params[:id])
end
the update action is:
def update
raise params.inspect
@vendor = Vendor.find(params[:id])
respond_to do |format|
if @vendor.update_attributes(params[:vendor])
flash[:notice] = 'Vendor was successfully updated.'
format.html { redirect_to :action => 'index' }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @vendor.errors, :status
=> :unprocessable_entity }
end
end
end
the edit.html.erb file is:
<% form_for :vendor do |form| %>
<fieldset>
<legend><%= @title %></legend>
<%= error_messages_for 'vendor' %>
<%= text_field_for form, "name" %>
<%= text_field_for form, "city" %>
<%= text_field_for form, "state" %>
<%= text_field_for form, "zip_code", ZIP_CODE_LENGTH %>
<%= text_field_for form, "phone_number" %>
<%= text_field_for form, "fax_number" %>
<%= text_field_for form, "web_url" %>
<%= submit_tag "Update", :class => "new_client_vendor_submit" %>
</fieldset>
<% end %>
There is nothing fancy, I am pretty much a novice at Rails. ;-)
Rick
On Feb 16, 4:05 pm, jemminger <[email protected]> wrote:
> Show us your action.
>
> On Feb 16, 7:03 pm, bearblu <[email protected]> wrote:
>
> > I just started working with Rails 2.2.2 and I don't seem to be having
> > much luck with the new routing scheme. When I try to edit a record
> > and save it I get and error message that looks as though it is trying
> > to use the id for the action. So just what am I doing wrong?
>
> > No action responded to 8. Actions: check_authorization, create,
> > destroy, edit, index, logged_in?, make_profile_vars, nav_link, new,
> > paginate, paginated?, param_posted?, protect, show, text_field_for,
> > and update
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---