Is there a Rails :remote => true equivalent feature in Phoenix 1.3 (for form submission)?
There is no such thing in phoenix. Take a look at drab for a similar feature.
1 Like
On my app I’ve simply used the rails-ujs node package (https://www.npmjs.com/package/rails-ujs) which gives you the remote features (among others).
Then all you need to do is set data: [remote: true]
on your form_for
and figure out if it was a “remote” request in the controller. This can be done simply by looking at the headers like so
case get_req_header(conn, "x-requested-with") do
["XMLHttpRequest"] -> true
_ -> false
end
Drab might be a better fit but if you want to get Rails remote in your app this is a way to do it.
3 Likes
Unpoly.js as well.
1 Like