I have a series of resources that I want only available if accessed via the JS format. Rails\' route resources gives me the formats plus the standard HTML. Is there a way
None of the above solutions worked for me. I ended up going with this solution:
post "/test/suggestions", to: "test#suggestions", :constraints => -> (req) { req.xhr? }
Found on https://railsadventures.wordpress.com/2012/10/07/routing-only-ajax-requests-in-ror/#comment-375