Restrict application layout for certain views

27 views
Skip to first unread message

Jason Walsh

unread,
Jul 25, 2015, 3:46:10 PM7/25/15
to rubyonra...@googlegroups.com
Hi folks

Is there any way to change / restrict the application layout for certain
views?

For example, I don't want to render the header for a certain view, is
there any code such as:

<% if View != show.html.erb%>
<%= render 'layouts/header' %>
<% end %>

Thanks in advance

Jason

--
Posted via http://www.ruby-forum.com/.

Elizabeth McGurty

unread,
Jul 25, 2015, 4:57:30 PM7/25/15
to Ruby on Rails: Talk, li...@ruby-forum.com
You could just set some session variable at the point of controller => show.  And test at your rendering.  However, I think that you are better off studying and learning methods associated with your Controller middleware...
Liz

Dave Aronson

unread,
Jul 25, 2015, 6:09:09 PM7/25/15
to rubyonrails-talk
On Sat, Jul 25, 2015 at 3:44 PM, Jason Walsh <li...@ruby-forum.com> wrote:

> Is there any way to change / restrict the application layout for certain
> views?

You can do that by specifying the layout in the controller. See:

http://guides.rubyonrails.org/layouts_and_rendering.html#the-layout-option

-Dave

--
Dave Aronson, consulting software developer of Codosaur.us,
PullRequestRoulette.com, Blog.Codosaur.us, and Dare2XL.com.

Jason Walsh

unread,
Aug 9, 2015, 1:46:43 PM8/9/15
to rubyonra...@googlegroups.com
Dave Aronson wrote in post #1176892:
Thanks
Reply all
Reply to author
Forward
0 new messages