All threads / Root route bypassing before_action

Ask A Question


You’re not receiving notifications from this thread.

Root route bypassing before_action

Peter vande Put asked in Rails

we have a posts_controller which takes a slug to render the correct page.
posts_controller inherits from application_controller which has a couple of before_actions

routes.rb has the following root

    root  'posts#show_post'

The before_actions are not called when going to localhost:3000 which renders the correct post.

also in the log i don't see the show_post action being called.
What am I missing here?

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 53,130+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2021 GoRails, LLC. All rights reserved.