Rails 4 - Name Of Current Layout?

后端 未结 3 678
我在风中等你
我在风中等你 2021-02-14 01:20

I\'ve found numerous resources for Rails 3, but none for Rails 4:


In an effort to keep things DRY, we have a method which defines some meta tags. I\'d like to incl

3条回答
  •  情话喂你
    2021-02-14 01:43

    For me in Rails 6 the current_layout method would look like this

    def current_layout
      self.controller.send :_layout, self.lookup_context, []
    end
    

    I believe the array is a list of formats used. The method _layout is build dynamically and I'm not sure what it's expecting in the formats parameter, but I got my desired behaviour with just an empty array Hope this helps.

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题