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