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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:19:25+00:00 2026-05-25T18:19:25+00:00

Seeing a problem with using form_for with a nested resource where I have remapped

  • 0

Seeing a problem with using form_for with a nested resource where I have remapped the route to be more sensible.

My routes.rb:

resources :books do
  resources :sections, :controller => 'content_sections'
  member do
    post 'publish'
  end
end

And my _form.html.haml

= form_for [@book, @content_section] do |f|
  -if @content_section.errors.any?
    #error_explanation
      %h2= "#{pluralize(@content_section.errors.count, "error")} prohibited this section from being saved:"
      %ul
        - @content_section.errors.full_messages.each do |msg|
          %li= msg

  .field
    = f.label :name
    = f.text_field :name

This is resulting in this error:

undefined method `book_content_sections_path' for #<#<Class:0x00000103a58238>:0x00000103a4a0e8>

What I’m expecting is book_sections_path but it is failing to take into account the setting in routes.rb.

  • 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-25T18:19:26+00:00Added an answer on May 25, 2026 at 6:19 pm

    Since there is no real relationship between models and controllers, then you will need to specify the URL when not using standard conventions:

    form_for [@book, @content_section], :url => book_sections_path(@book, @content_section)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am seeing a strange problem: I have a linux machine, installed JDK1.6 on
So, I am seeing a curious problem. If I have a function // counter
I am seeing a problem where I send large messages over wcf net.msmq using
Seeing as Java doesn't have nullable types, nor does it have a TryParse(), how
Today I coded a function that uses two nested foreach loops. After seeing, that
Here the problem. I have my site hosted on a shared hosting for asp.net
I have a web app using thin clients (bosanova terminals) as the front end
Gday All, I have a baffling problem whilst trying to insert some chinese characters
I am using this autocomplete Plugin which works great but the problem is $('#request_song').autocomplete({
I am using Coldfusion 8 which is connecting to SQL Server 2008, the problem

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.