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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:55:35+00:00 2026-06-10T12:55:35+00:00

I am new to rails and I started working with nested resources. I have

  • 0

I am new to rails and I started working with nested resources. I have been reading this http://guides.rubyonrails.org/routing.html#nested-resources so I created 2 models, a product and a senders. Product has many Senders. My Sender model is this:

class Sender < ActiveRecord::Base
  attr_accessible :product_id, :email, :name

  belongs_to :product
end

My product is this

class Product < ActiveRecord::Base
  attr_accessible :name, :price

   #Relationships !
   has_many :senders,  dependent: :destroy
end

in my routes.rb:

  resources :products do
     resources :senders
  end 

now rake routes gives me all the right routes it should, according to http://guides.rubyonrails.org/routing.html#nested-resources

So when I type in the URL

http://localhost:3000/products/1/senders/new

so I create a new sender for my product with id = 1 I get this:

 NoMethodError in Senders#new

undefined method `senders_path' for #<#<Class:0x00000003fcf9d8>:0x00000003e6f408>

Why do I get this undefined method since it should give me the new.html.erb page for the sender of that product??

  • 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-10T12:55:36+00:00Added an answer on June 10, 2026 at 12:55 pm

    Notice that if you did rake routes, you would not find the route you are looking for. This is because your routes for senders are nested within products.

    Therefore, if you want to create a new sender, the path should be something like new_product_sender_path(product).

    So, to get all the senders of a particular product, the path would be product_senders_path(product).

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

Sidebar

Related Questions

I'm new to Rails, and I was working through the tutorial here: http://guides.rubyonrails.org/getting_started.html When
I am going working through the Rails Guides (http://guides.rubyonrails.org/getting_started.html),and am stuck at item 11
Started working on a new application this week that is running the latest rails
Im using the following guide for getting started with rails for ubuntu 9.10. http://guides.rails.info/getting_started.html
I have started developing a new Rails app on my server using RVM, Rails
Our team is working on a new application that we started with Rails 3.1
First I'm quite new to ruby and rails... I have a little application working
HI i am new to rails i started working on one existing project. i
I've just started a brand new rails project and the first task I'm trying
I am new to ruby on rails and started a tutorial and found out

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.