It renders partials without a problem but when I need it to render
from :controller => 'manage', :action => 'new' I receive:
ActionController::MethodNotAllowed
Only get, put, and delete requests are allowed.
The AJAX code is making a POST request. Change the routing to allow POSTs or
change the template or RJS to make a GET request (probably add ':method =>
:get') to parameter list. If the action does not alter the state, use the
former, otherwise use the latter. E.g., is it okay if a search engine spider
invokes the 'new' action? From the name, I'd guess not. So change the
routing to allow or even require POST requests.
You are running into Rails/RESTful convention. In those conventions, the
new action is a GET that returns the form for a new object. The create action
expects a POST with the data for the new object. If this is not the semantics
of your app or controller, either don't use 'map.resources' which does conform
to the Rails/RESTful way, or change your actions and routes.
The 'new' action creates 3 empty models and displays the form to fill
in the properties for the 3 new objects (all from 1 form).
Create is followed from new to save the objects to the db etc via post
as expected.
So I suppose the best idea would be to find a way to make the
Ajax.Updater run via :get instead of :post. So I may keep my proper
RESTful resources.
The script for the Ajax.updater is:
function reloadPane(pane, src) {
new Ajax.Updater(pane, src, {asynchronous:1, evalScripts:true,
onLoading:function(request){pane.innerHTML='<img alt="Wait" src="/
images/spinner.gif" style="vertical-align:-3px" /> Loading...'}})
}
method:'delete'
I tried using:
function reloadPane(pane, src) {
new Ajax.Updater(pane, src, {asynchronous:1, evalScripts:true,
method:delete, onLoading:function(request){pane.innerHTML='<img
alt="Wait" src="/images/spinner.gif" style="vertical-align:-3px" />
Loading...'}})
}
This didn't work but just now I found an example with:
method:'delete' . Maybe the lack of quotes is what killed the script.
I'll try that as soon as I get home and post back.