This project is archived and is in readonly mode.
Please add :position => :replace to link_to_remote (and family)
-
Sai Emrys
Any progress on this? I'd like it too.
-
Carsten Gehling
I think development focus is more on RJS, but I could sometimes need this too. I'll have a look and see what I can do.
/Carsten
-
Carsten Gehling
In the meantime, you could use :update and reference an immediate parent container.
/Carsten
-
Carsten Gehling
...or you could just put your responding RJS code in a template file:
youraction.rjs
page.replace 'some_dom_id', :partial => 'new_contenThen you've got your view/controller separation back
/Carsten
-
Deleted User
The problem with referencing the immediate parent is that you are then tightly coupling a partial to its container. It just seems totally natural to 'replace self', as it were.
With rails3 on the horizon, I'm not sure if this makes sense in the rails3/unobtrusive world, but I still miss it in the 2.x world.
-
Carsten Gehling
Agreed, but it was also only meant as a short-term fix - until I saw how old this ticket is :-)
But better yet ATM is the rjs-template file to decouple controller and view code.
I would say that even with unobtrusive JS in Rails3, this is still a valid issue. link_to_remote(:update => etc..) will still be usable. The only difference will be, that the javascript is not generated inline - instead you add some classnames and let an external JS handle the job. From a rails-programmers perspective, there will be no difference.
/Carsten