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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:47:30+00:00 2026-06-15T03:47:30+00:00

I have a nested model resources :customers do resources :readings end I would like

  • 0

I have a nested model

resources :customers do 
 resources :readings
end

I would like to now access my ../customerid/readings/new view from the show view of a customer.

How can I call the new readings view using a button when in the customers show view?

Customer’s show.html

<%- model_class = Customer -%>
<div class="page-header">
<h1><%=t '.title', :default => model_class.model_name.human %></h1>
</div>

<dl class="dl-horizontal">
<dt><strong><%= model_class.human_attribute_name(:name) %>:</strong></dt>
<dd><%= @customer.name %></dd>
<dt><strong><%= model_class.human_attribute_name(:customer_currency) %>:</strong></dt>
<dd><%= @customer.customer_currency %></dd>
<dt><strong><%= model_class.human_attribute_name(:payment_terms) %>:</strong></dt>
<dd><%= @customer.payment_terms %></dd>
<dt><strong><%= model_class.human_attribute_name(:phase_type) %>:</strong></dt>
<dd><%= @customer.phase_type %></dd>
<dt><strong><%= model_class.human_attribute_name(:billing_address) %>:</strong></dt>
<dd><%= @customer.billing_address %></dd>
<dt><strong><%= model_class.human_attribute_name(:first_name) %>:</strong></dt>
<dd><%= @customer.first_name %></dd>
<dt><strong><%= model_class.human_attribute_name(:last_name) %>:</strong></dt>
<dd><%= @customer.last_name %></dd>
<dt><strong><%= model_class.human_attribute_name(:mobile) %>:</strong></dt>
<dd><%= @customer.mobile %></dd>
<dt><strong><%= model_class.human_attribute_name(:email) %>:</strong></dt>
<dd><%= @customer.email %></dd>
</dl>


<div class="form-actions">
<%= link_to t('.back', :default => t("helpers.links.back")),
          customers_path, :class => 'btn'  %>
<%= link_to t('.edit', :default => t("helpers.links.edit")),
          edit_customer_path(@customer), :class => 'btn' %>


<%= link_to t('.destroy', :default => t("helpers.links.destroy")),
          customer_path(@customer),
          :method => 'delete',
          :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm",   :default => 'Are you sure?')) },
          :class => 'btn btn-danger' %>
</div>
  • 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-15T03:47:32+00:00Added an answer on June 15, 2026 at 3:47 am

    According to the “2.7 Nested Resources” Chapter of Ruby on Rails Guide on Routing, to get the following URL /customers/:customer_id/readings/new, use this:

    customer_readings_path(@customer) # Generate the path for new Reading which belongs to @customer
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a nested model resources: customers do resources: readings end I am trying
I have a nested model resources :customer do resources :readings end Customers model has
I have a nested model structure that looks like this: resources :users, :path =>
I have nested iframes and I would like to use onload function for the
I am new to rails and I started working with nested resources. I have
I have a model Model that can be access from many ways: by subdomain
I have built a nested resources between question and answer model. This is form
If you have a nested resource defined like this: map.resources :magazines, :has_many => :ads.
I have a nested resources: resources :bills do resources :debts end and when I
I have a model called newbie. The routes.rb file looks like: Myapp::Application.routes.draw do resources

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.