I am trying to develop an application that allows users to submit
articles and add information about the references they used when
citing facts.  I have the sources broken down into types, such as
books, periodicals, web-sites, etc as single table inheritance on the
sources table.  Routes are nested so that :articles, :has_many
=> :sources  When trying to edit a source, through the "edit" view, I
get  "ActionController::MethodNotAllowed - only get, put, and delete
requests are allowed".  This should flow through the "update" action,
which is a put method, and when I used rake routes on the command line
it looks like it is routed correctly   PUT  /articles/:article_id/
sources/:id(.:format)  {:controller => "sources", :action =>
"update"}

My edit view contains the following code:

<% form_for :source, @source, :url => {:action => "update"} do |f| %>

....form fields....

<%= f.submit "Update" %>

<% end %>

My controller has the following code:

def edit
  @source = @article.sources.find(params[:id])
end

def update
  @source = @article.sources.find(params[:id])
  if @source.update_attributes(params[:source])
    flash[:notice]...
    redirect_to article_path(@article)  #...@article is derived from
before filter
  else
    render :action => "edit"
  end
end

Any suggestions?

Thanks for you help!!!

-Kevin

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to