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 7884645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:51:21+00:00 2026-06-03T04:51:21+00:00

I gave a controller called reports in my Rails 3 application. The index section

  • 0

I gave a controller called reports in my Rails 3 application. The index section of the controller looks like this:

def index
    #@reports = Report.all

    @clinical_income_by_month = Clinical.income_by_month                      
    @clinical_income_by_employee = Clinical.income_by_employee
    @clinical_income_by_vet = Clinical.income_by_vet                          
    @consult_consult_times = Consult.consult_times
      @clinical_healthplan_high_spenders = Clinical.healthplan_high_spenders

    respond_to do |format|
      format.html # index.html.erb
      format.json { render json: @reports }
    end
  end

The index.html.erb code looks like this:

<h6><b>Financial Reports</b></h6>
    <dl class="vertical">
      <dd><a href="/income_by_month">Income by Month</a></dd>
      <dd><a href="/income_by_employee">Income by Employee</a></dd>
      <dd><a href="/income_by_vet">Income by Vet</a></dd>
 </dl>

I have split the reports which were originally all in index.html.erb under jQuery tabs into their own pages.

What is the best way to make the links to the individual reports load? Currenly if I visit the links or manually enter http://0.0.0.0:3000/reports/income_by_month.html I get an unknown page error.

Any pointers would be appreciated!

  • 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-03T04:51:22+00:00Added an answer on June 3, 2026 at 4:51 am

    One of your first steps is to add methods in your controller for each of the different reports. These go in your config/routes.rb file:

    resource :reports do
      member do
        get 'income_by_month'
        get 'income_by_employee'
        get 'income_by_vet'
      end 
    end
    

    The result of this is to give you paths to your reports of:

    income_by_month_reports    GET    /reports/income_by_month
    income_by_employee_reports GET    /reports/income_by_employee
    income_by_vet_reports      GET    /reports/income_by_vet
    

    Then, in your erb the best way to refer to the reports using _path variables like so:

    <h6><b>Financial Reports</b></h6>
    <dl class="vertical">
      <dd><a href='<%= income_by_month_reports_path %>'>Income by Month</a></dd>
      <dd><a href='<%= income_by_employee_reports_path %>'>Income by Employee</a></dd>
      <dd><a href='<%= income_by_vet_reports_path %>'>Income by Vet</a></dd>
    </dl>
    

    A good place for you to start is this primer called “Ruby on Rails Guides: Rails Routing from the Outside In”

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

Sidebar

Related Questions

I gave this in my site.master <li><%= Html.ActionLink(Material, Index, Material)%></li> But my link doesnt
hi i am trying to create a URL that looks like this: black/granite/worktops where
in my current project ive a controller tree like this: Controller - ------Admin -
This supposedly easy task gave me some headache. I simply want to let the
On Friday I gave a demo of an MVC application using the Authorize attribute
I have one model: new and its controller: news The news controller methods: def
In my rails application I am trying to use rails3-jquery-autocomplete gem. I included the
In the rails 2 version of my app I have this resource defined map.resources
I have a C++ application designed according to a classic Model-View-Controller pattern . The
Rails noob who has researched for weeks and tried all kinds of ways to

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.