Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8019851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:30:58+00:00 2026-06-04T21:30:58+00:00

I have a strange problem with my Rails routing . I have a controllers

  • 0

I have a strange problem with my Rails routing .
I have a controllers called Page and a method called Page#dashboard

When I try to access /dashboard/1 the dashboard method of Page Controller never gets executed.
But surprisingly the /pages/dashboard.html.erb is rendered fine .

Can someone explain me why ?

Code details as below . Thanks

Trying to access – /dashboard/1

Routes.rb

match '/dashboard/:id' => 'page#dashboard'

Page_Controller.rb

class PageController < ApplicationController

  before_filter :init

  private

  def init

    puts "init getting executed !!!!!!!!!"  #this gets printed on console

  end

  def dashboard

     puts "dashboard getting executed !!!!!!!!!" #this doesnt get printed on console


  end

end

viewPage – Pages/dashboard.html.erb

The logs are shown as below –

init getting executed !!!!!!!!!
Started GET "/dashboard/8" for 127.0.0.1 at 2012-06-03 00:04:40 +0800
Processing by PageController#dashboard as HTML
  Parameters: {"id"=>"8"}
  Rendered page/dashboard.html.erb within layouts/page (45.9ms)
Completed 200 OK in 180ms (Views: 133.6ms | ActiveRecord: 3.1ms)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T21:30:59+00:00Added an answer on June 4, 2026 at 9:30 pm

    First off, you don’t have to define an action method. If all you want to do is render a template then as long as the template foo exists, rails will happily allow you to route to SomeController#foo.

    Secondly, for a method to be an action is has to be public. Your dashboard method is private so it doesn’t count as an action and doesn’t get executed. Since you have a dashboard.html.erb template, rails does however render that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a strange problem. I have never had it before. When I try
I have a strange behavior of Rails 3.0.10. Got this application controller: app/controllers/application_controller.rb require
I have a strange problem that I could not solve. When I try to
So I'm having a strange problem with my rails routing, when I go to
I have a strange issue with to_json method in my Rails 3 app. (well
I have a strange problem in rails. Whenever I create a new record via
I have a strange problem in rails: When I type a command in cmd
I am using Ruby on Rails 3.2.2 and I have a strange problem. In
i have a strange rails 3.2 problem. when i submit a form like this:
i have strange problem doing reporting: i have numerous clients with different issued invoices.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.