On Mar 3, 2009, at 1:12 PM, Matt Aimonetti wrote:

> Why not doing something like
>
> string_to_render = a.exists? ? a : b
> render a

I should have been clearer:

I want to be able to write generic index etc templates, and then  
render those if the template for the current controller doesn't exist.  
So a file structure like this:

foo
        index.html.erb
        edit.html.erb
bar
        edit.html.erb
default
        index.html.erb
        edit.html.erb

and then I can say something like:

render_or :template => "#{controller.name}/index", :fallback => '/ 
default/index'

I could just do this with an application helper which would catch the  
exception and render the fallback. I'm just wondering if I'm  
reinventing a wheel is all.

--~--~---------~--~----~------------~-------~--~----~
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby
-~----------~----~----~----~------~----~------~--~---

Reply via email to