Displaying 1 result from an estimated 1 matches for "_optional_fields_user".
2007 Sep 15
0
Better render_if_exists
...little polymorphic page (I mean that you use the same
page to deal with objects coming from different models, for instance
users and products) and I need to render some partial templates if they
exist, 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 :
&l...