4 ms·
I don't quite get the reference to "magic"... It's quite easy to get what this does, and surely not every function call can be considered "magic"?
by matt4077 9y ago
I don't quite get the reference to "magic"... It's quite easy to get what this does, and surely not every function call can be considered "magic"?
- matthewmacleod 9y agoYou're right, of course – I would consider this 'Rails magic' because it fits the general pattern of all those cool UJS helpers that are available. Things like `form_for(remote: true)` or `link_to remote: true`. This is just an extension of the same principle, which I think of as being basically magic!
- tomphoolery 9y agoI kinda wish it worked more like UJS though, rather than rendering a partial with <script> tags it could be just rendering some arbitrary <div> tag that, when it exists on the page, fires an event for rendering a partial asynchronously on the page. the UJS helpers for doing this already exist, because `link_to remote: true` is a thing. instead of making the GET request when the link is clicked, we're just triggering the link to be clicked right there in the page.