8000 GitHub - dominicsayers/momkid: A simple Rails project to demonstrate something odd about parent_child_path · GitHub
[go: up one dir, main page]

Skip to content
  • dominicsayersPublic

    About

    A simple Rails project to demonstrate something odd about parent_child_path

    Resources

    Stars

    0 stars

    Watchers

    1 watching

    Forks

    Latest commit

     

    History

    662 Commits

    Folders and files

    < 8000 tr class="react-directory-row truncate-for-mobile" id="folder-row-16">
    NameName
    Last commit message
    Last commit date
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    Repository files navigation

    StackOverflow question 7337446

    I have an Rails 7 app with a parent object Mom and child object Kid. The scaffolds were as far as possible generated rather than hand-coded. In /app/views/kids/_kid.html.erb I added

    <em><%= mom_kid_path(kid) %></em>
    

    For a Mom with id 1 and a Kid with id 2 this is showing /moms/2/kids/1, which is the wrong way round.

    All I have in /config/routes.rb is

    resources :moms do
      resources :kids
    end
    

    What did I do wrong?

    The code for the app is at https://github.com/dominicsayers/momkid. The exact steps I took to create the app are here: https://blog.dominicsayers.com/howto-create-a-simple-parent-child-form-in-rails-3-1/. I'm happy to add any other specific information that is requested.

    Note that I originally asked this question back in the days of Rails 3.1. Given that the result hasn't changed and the question still stands now we're on Rails 7 I have to conclude it is by design and I must have done something wrong in the setup to get this counterintuitive result.

    About

    A simple Rails project to demonstrate something odd about parent_child_path

    Resources

    Stars

    0 stars

    Watchers

    1 watching

    Forks

    Releases

    Packages

    Used by

    Contributors

    Languages

    0