search for: render_if_exists

Displaying 1 result from an estimated 1 matches for "render_if_exists".

2007 Sep 15
0
Better render_if_exists
...t, and get no error if they don''t (for instance I''ve got a partial template called _optional_fields_user which I''d like to load, but _optional_fields_product doesn''t exist and I''d like to use the same code to load both. So I build a little helper : def render_if_exists toRender begin render toRender rescue ActionView::ActionViewError end end and I call it : <%=render_if_exists :partial =>"optional_fields_#{@element.className}"%> Everything works fine but I think it''s ugly to do it this way, would anyone have anything bett...