Is there a standard approach to the controller actions that exist
solely to populate data do be shown in a view when using RESTful
routing?
I understand and almost appreciate the 7 actions that exist to
implement the ideas of RESTful routes in RoR, but consider a select
box whose contents change based on the contents of some other select
box. The little I’ve learned of AJAX and RoR show me how to do this
using #remote_function, but that implies that there is an action to be
invoked on the controller to implement that remote function.
I have played games with calling the #new and #edit actions and
checking for the magical parameter passed in the :with clause. Is
that what folks do? It’s nice in that it provides a graceful way to
degrade (and/or test) using normal HTTP requests with ?param=blah
tacked on the end, but it starts to look pretty ugly (to me) as
additional parameters get added. Also (what I’m running into now),
where’s the benefit of updating only one small portion of a page when
the #new action is designed to render the whole page?
If this is a FAQ, please feel free to point me at the appropriate blog
or Railscast that explains how the professionals do this.
–wpd