For some ‘minor’ actions in my site, I’m using remote instead of standard HTML requests. My current remote technique is like this:
- Use
form_fororform_tagwith:remote => true. -
In the controller action, do:
respond_to do |format| format.js end -
Then create a
.js.erbfile that loads a partial / creates a flash message / highlights parts of the page, etc.
I want to understand the implications of my approach because I don’t want my own ignorance to lead to problems I don’t know about.
- Are there any accessibility problems with the above, i.e. are there people who wouldn’t be able to use my code above due to their browser / disability / something else?
- Is the above the ‘current’ way to do things in Rails, or can you point me to something that is better?
- Are there any issues with security or performance that could be improved by doing it another way?
It doesn’t lead to more browser issues than usual js
I’d say it’s the current way for low traffic or few actions (like admin reserved area)
Using this technique leads to more server work than basic ajax returning json handled fully client-side.