RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

Change sidebar content for certain Rails controllers

Most (or even all) pages in your Rails application have the same sidebar content, but just one needs to show something different? On your login and registration pages, you don’t want to show the last five books/movies/events, but a marketing text why people should signup for your site? You’re currently using an if/elseif/else statement to switch content based on the controller’s name? I’ll show you how to fix this with the help of Rails’ template inheritance: https://christoph.luppri.ch/articles/2017/09/03/change-sidebar-content-for-certain-rails-controllers/

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in