views - Check if a layout exists in Rails? -


Is there a standard way to check if a visual layout exists from within a controller in the rail? I am trying to allow the user to set the layout, but it must be present first.

As far as I know there is no standard public way, you can use such a fundamental call Can:

  layout = Dir ['app / view / layout / *']. Map {| F | File.basename (f, '.html.erb') Returns 'Layout' for # 'layout.html.erb'}  

Comments