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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:54:18+00:00 2026-05-22T01:54:18+00:00

Trying to route: scope :shortcut do resources :text_elems end Using basic scaffold with form

  • 0

Trying to route:

scope :shortcut do
 resources :text_elems
end

Using basic scaffold with form partial

*_form.html.erb*
<%= form_for(@text_elem, :shortcut => @shortcut) do |f| %> 
...

Problem is: When I call the edit action, the form html shows as:

<form ... action="/25/text_elems/25">

Note: The new action renders the form action correctly:

<form ... action="/home/text_elems">

So it appears that my :shortcut param is getting trumped by the :id param when form_for processes it’s block. Now I am able to get the action to correctly route with the :shortcut param if I manually make the :url => {…} in the form_for block, but I would prefer to keep the code dry, plus I want to report this problem to rails if it is indeed a bug.

Can anyone else confirm this as a bug?

  • 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-22T01:54:19+00:00Added an answer on May 22, 2026 at 1:54 am

    Actually, you can pass the values as a full hash, rather than trying to rely on the default to_param (which is what gets called if all you do is pass the @text_elem)

    <%= form_for({:id => @text_elem.to_param, :shortcut => @shortcut}) do |f| %> 
    

    however, if this is actually a nested-resource, you could also do:

    <%= form_for([@shortcut, @text_elem]) do |f| %> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a route that can allow for different formats (html/json/xml
I'm trying to use an offline MBTiles database using Route-Me . To accomplish this,
I'm trying to use route constraints in an Asp.Net MVC Application. routes.MapRoute( theRoute, MyAction/{page},
I am trying to create a route with a Username... So the URL would
I'm trying to cobble together a php style include function for javascript. The route
I'm trying to create a route and then programatically retrieve the url of that
I'm trying to route a path like this: http://www.wikipediamaze.com/wiki/Washington,_D.C. The routing framework is not
I am trying to route every request(with params) to file home.php without changing the
I'm trying to create a route to a specific controller/action which needs to accept
I'm trying to write a route that captures the one-to-many relationship between posts and

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.