Displaying 1 result from an estimated 1 matches for "contact_view".
2006 Feb 14
22
Teaching Models to Render Themselves in the Controller
...efore this gets shot
down as anti-MVC.
Let''s say I am writing a contact-management application. I have a
class Contact. I will need to display this class all over the
application. My first choice is to use a partial.
Now I can render my Contact with:
<% render_partial ''contact_view'', :contact => my_contact %>
However, I start doing some ajax things, where I need to render a
contact and return it with an AJAX call. So, I simply render the
partial from my controller. Not too bad, as long as I can keep
straight what partial to call and what locals I need to...