I’m trying to update shoulda gem to be Rails 3 compatible and got a
problem with fetching layout name. There’s the following code in
which in Rails 2 returns i.e. ‘layouts/application’. When this code is
executed in Rails 3, Rails prints out deprecation warning that
‘template.layout’ should be used instead. However, the ‘template’
method is defined in ActionController::Compatibility module and
returns ‘view_context’ object. Additionally it has the following
comment: “TODO: Remove this after we flip” So, is the deprecation
message mentioned above already deprecated?
What’s the proper way to fetch layout name?
@controller.template.layout? @controller.view_context.layout? Besides,
response.layout returns just a layout name, while template.layout
returns a full path to a layout file (i.e. “/Users/…/views/layouts/
application.html.erb”) - is there a way to get response.layout like
result in Rails 3?