Doug,

This may actually be worse but it is another way...

<% begin %>
  <%= render :partial => 'custom' %>
<% rescue ActionView::MissingTemplate %>
  Default
<% end %>

Anthony Crumley
http://commonthread.com


On Fri, Apr 9, 2010 at 7:29 PM, doug <[email protected]> wrote:

> Suppose that I want to have a block of default content within a
> template that is replaced with the content of a specific partial only
> if that partial exists.  Obviously there is the brute force approach
> of simply rendering the default content unless the relevant partial
> file exists in which case the relevant partial is rendered instead.  I
> suspect that there may be a more elegant way to skin this cat.  Any
> suggestions?
>
> Thanks for any input.
>
>          ... doug
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<rubyonrails-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to