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

  • Home
  • SEARCH
  • 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 6199223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:09:08+00:00 2026-05-24T04:09:08+00:00

I am a new guy, a java programmer. Using namespace encountered difficulties in rails3.

  • 0

I am a new guy, a java programmer.

Using namespace encountered difficulties in rails3.

rails g scaffold ns::e1 name:string  
rails g model ns::e2 name:string e1:references  
rake db:migrate

edit app/models/ns/e1.rb

class Ns::E1 < ActiveRecord::Base  
  has_many :e2s  
end

edit app/views/ns/e1s/show.html.erb

<p id="notice"><%= notice %></p>  
<p>  
  <b>Name:</b>  
  <%=@ns_e1.name%>  
</p>  
<%= form_for([@ns_e1, @ns_e1.e2s.build]) do |f| %>  
  <div class="field">  
    <%= f.label :name %>  
    <br/>  
    <%= f.text_field :name %>  
  </div>  
  <div class="actions">  
    <%= f.submit %>  
  </div>  
<% end %>  
<%= link_to 'Edit', edit_ns_e1_path(@ns_e1)%>|  
<%= link_to 'Back', ns_e1s_path %>  

Error is undefined method `ns_e1_ns_e2s_path’

How to configure routes.rb ? Thanks

Thanks ream88, I found a solution.

Edit the routes.rb.

namespace :ns do
  resources :e1s do
    resources :e2s, :as => :ns_e2s
  end
end
  • 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-05-24T04:09:08+00:00Added an answer on May 24, 2026 at 4:09 am

    I’ve used named-spaced models since I started with Rails back in 2007, and unfortunately Rails isn’t very good at handling name-spaces. Its very better now with Rails 3, but you still have to write more code than usual. And I’m always ending up, writing my own routes without namespaces. For example:

    I have following two models:

    class MyAwesomeBlog::User < AR::Base
    end
    
    class MyAwesomeBlog::Post < AR::Base
    end
    
    # routes.rb
    resources :users
    resources :posts
    

    Is this an option for you?

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

Sidebar

Related Questions

hi i am a totally new guy on JAVA OO concepts ,and this is
So I am an old web forms guy and new to the MVC (in
I have never developed for WAMP, the hosting guy for my new client says
New to javascript/jquery and having a hard time with using this or $(this) to
New to both Ruby and Rails but I'm book educated by now (which apparently
I'm a C# guy trying to learn Java. I understand the syntax and the
I am a new guy in Ruby, and I have tables with these primary
I`m a new guy to c# and I try to add a some code
I'm a new guy in PHP OOP concepts. One of the first things that
After fighting several versions of the CoreKeyGen created by some minamoto guy, a new

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.