Still a semi-newbie, but so far I’ve managed to solve most things with a
bit of help from the Agile book, some googling around, and a bit of
trial-and-error, but I’m really stuck with this one (very much an Ajax
I know how to gracefully degrade an AJAX newpost type call so it can
appear inline or (for those without JS support) go to a new page (put an
“:href => url_for” in the link_to_remote).
I also know how to DRY up two (non-AJAX) actions so that you use the
same newpost for both the original call and processing the form info (if
request.get? … elsif request.post?).
I even know how to have it so the same newpost action can handle the
original request and tell if it’s an AJAX request or not, so I can use
just one action for AJAX and none AJAX requests
What I can’t work out to do is how to have it so the processing of the
AJAX a form info is done in the same action as the original AJAX call
(they are both posts, right?), and it’s forcing me to have a createpost
action, just for the AJAX route.
If I could work this out, I could then have one neat action that wrapped
the whole thing up in a nice DRY, gracefully degrading way.
Can anyone help?