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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:30:21+00:00 2026-05-18T23:30:21+00:00

So, I got this error Couldn’t find MenuBar with ID=add_page_to_menu But my code for

  • 0

So, I got this error

Couldn't find MenuBar with ID=add_page_to_menu

But my code for the link that creates that error is as follows:

<%= link_to "add", 
              :controller => "admin/menu_bars", 
               :action => "add_page_to_menu", 
               :page => page.id,
               :menu => @menu_bar.id %>

The URL that I get the error on is

http://example.com/admin/menu_bars/add_page_to_menu?menu=1&page=1

it should look something like example.com/admin/menu_bars/add_page_to_menu/1?menu=1&page=1
(I think, I could be wrong, seeing as how its not working =(

the corresponding action in the controller:

  def add_page_to_menu
    @menu_bar = MenuBar.find(params[:menu])
    @page = LinkPage.find(params[:page])

    @menu_bar.link_pages << @page
    if @menu_bar.save
      format.html { render :action => "edit" }
    else
      format.html { render :action => "edit" }
      format.xml  { render :xml => @menu_bar.errors, :status => :unprocessable_entity }
    end
  end

Routes:

 map.namespace "admin" do |admin|
    admin.root :controller => :site_prefs, :action => :index
    admin.resources :site_prefs
    admin.resources :link_pages
    admin.resources :menu_bars
  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-18T23:30:22+00:00Added an answer on May 18, 2026 at 11:30 pm

    Your route is going to eval to

    http://example.com/admin/menu_bars/:id?menu=1&page=1

    so Rails is looking for a MenuBar with an ID of add_page_to_menu. You need to add a member method to the routes for your custom action. The routes should look like this:

    map.namespace "admin" do |admin|
      admin.root :controller => :site_prefs, :action => :index
      admin.resources :site_prefs
      admin.resources :link_pages
      admin.resources :menu_bars, :member => { :add_page_to_menu => :get }
    end

    and the link_to should look something like this:

    link_to("add", menu_bar_add_page_to_menu_path(@menu_bar, :page => @page.id)

    and the url produced should look something like this:

    http://example.com/admin/menu_bars/1/add_page_to_menu?page=1

    There’s still some optimization to be done in that, but I think it will get you beyond this issue at least.

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

Sidebar

Related Questions

I got this error when i press a button, but i searched for that
I got this error for a collection I am writing, but fxcop warned me
I got this error running a query that goes against 2 tables with combined
I got this error: ERROR/MapActivity(258): Couldn't get connection factory client Everything worked fine, it's
couldn't find a similar topic but this may boil down to not knowing how
I tried to launch my project, but i got this error while compiling it
I got this part inside my json object. But I couldn't get this as
I've tried to solve this error message but I couldn't. I've tried for a
Got this error on a big $_GET query in size ~9 000 symbols (they
Got this error message while trying to configure an entitydatasource in the designer: My

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.