S
S
StanisLove2015-09-03 09:28:09
Ruby on Rails
StanisLove, 2015-09-03 09:28:09

How to avoid loading application.html.haml view?

Good afternoon!
all internal pages of the site have a similar structure, i.e. the view part would be appropriate to place in application.html.haml.
What about pages that have a completely different structure?
You can make the view not load application.html.haml

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
TyzhSysAdmin, 2015-09-03
@POS_troi

guides.rubyonrails.org/layouts_and_rendering.html
Search in Conditional Layouts
Another option

class MyController < ApplicationController
  layout :resolve_layout

  # ...

  private

  def resolve_layout
    case action_name
    when "new", "create"
      "some_layout"
    when "index"
      "other_layout"
    else
      "application"
    end
  end
end

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question