I am working in rails project. I created a header and footer and added to all pages in layouts/application.html.erb file. Now I want to remove it from some pages. how can I do that?
Controllers support :only
and :except
options for layouts, see the Conditional layouts section in this guide.
So you can do the following in your controller:
class SomeController < ApplicationController
layout 'application', :except => [:some_action, :some_other_action]
...
Create a different layout, and apply that in the pages where you don't want to render the header and the footer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With