Is there a standard way to check if a view layout exists from within a Controller in Rails? I'm trying to allow the user to determine the layout, but it needs to exist first.
A:
There is no standard public way as far as I know. You could use a rudimentary call like this:
layouts = Dir['app/views/layouts/*'].map {|f|
File.basename(f, '.html.erb') # returns 'layout' for 'layout.html.erb'
}
Daniel Beardsley
2010-05-17 22:39:55
A:
I think the better way would be store these values in a database, let a user choose from that.
Instead of trying to verify through what has been suggested in the previous post.
Use a Layout Model and let the user choose.
Rishav Rastogi
2010-05-18 00:01:37