This works in the js case: the restful route of calling selections_path
with a POST request sends me to selections/create.
But the href option doesn't work properly: it calls
"selections/index?resource_id=x"
Can i pass a restful route through to href as well? I've tried various
arrangements but it keeps breaking because of bad syntax. I have a
feeling that if i'm using a restful route helper i can drop url_for and
just point href at the helper but i can't work the syntax out for that
either.
I'm using link_to_remote, in a page that (as usual) needs to work for
non-js enabled browsers.
You could play with format.html. That should be called when JS is not
enabled.
something like...
format.html { redirect_to(resources_path) }
?
Hi Vapor
I have my formats set up fine, like you suggest: the problem is that it
doesn't reach them because it gets sent to the wrong controller action
(index instead of create) in the html case.
All i need is a link that sends an ajax request *or* an html request to
the same action and the same controller, depending on whether the user
has js enabled. This must be a very common requirement for any site,
which is why i'm going so crazy trying to work it out
hmmmm....in that case, can you see any other reason why it might request
the index action instead of the create action.
BTW, href doesn't support RESTful create action since create need to
be POST.
I wasn't sure about href, that's why i explicity passed through the
controller and action. It just seems to ignore the action though. I
have a feeling this is just to do with arranging my {}s and ()
properly...