This project is archived and is in readonly mode.
Uncountable inflections lead to exception with Rails 3 scaffolding
Reported by Christoph Olszowka | February 11th, 2010 @ 12:00 PM | in 3.0.2
On a vanila Rails 3 beta1 app as well as on edge, when you generate a scaffold based upon an uncountable word you'll get a routing error.
That's what I did:
rails g scaffold fish name:string
When going to http://localhost:3000/fish/new, I'll get:
ActionController::RoutingError in Fish#new Showing (...)/app/views/fish/_form.html.erb where line 1 raised: No route matches {:action=>"destroy", :controller=>"fish"} Extracted source (around line 1): 1: <% form_for(@fish) do |f| %>
The same happens for sheep (which, like fish, obviously is
included in the active support inflector defaults) or other
uncountable words I put in the inflection initializer. I also get a
warning when running the generator:
Plural version of the model detected, using singularized
version. Override with --force-plural.
Adding that option fixes the warning, but not the generated code.
Comments and changes to this ticket
-
Samuel Danielson February 23rd, 2010 @ 09:13 PM
I can confirm this bug. fish_url and fish_path will also raise
No route matches {:action=>"destroy", :controller=>"fish"}
The following...
resources :fish, :singular => :fish_instance
does not generate fish_instance_path and fish_instance_url as it did in Rails 2.3.5. Is there a work-around until this is fixed?
-
Jan De Poorter February 25th, 2010 @ 02:45 PM
- Tag changed from inflections, rails3, routingerror, scaffold to inflections, rails3, routing, routingerror, scaffold
This seems to be a routing issue rather then problems with scaffolding. I'm bumping into the same problem
-
Jan De Poorter February 25th, 2010 @ 03:25 PM
The attached patch should add _index to the uncountable resource (like it did in 2.3.5). This is only a partial solution to the scaffolding problem, but solves my problem with routes.
-
Yehuda Katz (wycats) February 25th, 2010 @ 04:16 PM
- Milestone cleared.
-
José Valim March 27th, 2010 @ 01:59 PM
- Assigned user set to josh
-
Rizwan Reza March 29th, 2010 @ 02:35 AM
- State changed from new to resolved
(from [cf6734fdf9d72bfc7fe92e36bf603d67ad815e6b]) Add more tests and docs to uncountable routes. [#3930 state:resolved] http://github.com/rails/rails/commit/cf6734fdf9d72bfc7fe92e36bf603d...
-
Rizwan Reza April 13th, 2010 @ 10:24 PM
(from [d6190c6dff33dce8e78e82d4a2578df444b46e65]) Add more tests and docs to uncountable routes. [#3930 state:resolved] http://github.com/rails/rails/commit/d6190c6dff33dce8e78e82d4a2578d...
-
Throlkim June 9th, 2010 @ 11:35 PM
I'm experiencing this same problem on Rails 3 beta 4. I have the following route:
resources :research
I receive the following error:
ActionController::RoutingError in Research#new No route matches {:action=>"destroy", :controller=>"research"} Extracted source (around line [#1](/projects/8994/tickets/1 "Ticket #1")): 1: <%= form_for @research, :as => :research do |f| %> 2: <% if @research.errors.any? %> 3: <div id="error_explanation"> 4: <h2><%= pluralize(@research.errors.count, "error") %> prohibited this research from being saved:</h2>
Is there a way to resolve this, or is it still an ongoing bug?
-
Neeraj Singh June 10th, 2010 @ 04:35 PM
@Throlkim It works for me with latest master.
rails generate scaffold research title:string rake db:migrate rails server # visit http://localhost:3000/researches
I am able to visit index page and am able to create a new research.
-
Throlkim June 10th, 2010 @ 04:41 PM
@Neeraj, Did you set it up as uncountable? My route is http://localhost:3000/research :) I'm running the latest master too, as of last night methinks.
-
Christopher Redinger June 18th, 2010 @ 09:28 PM
Definitely still broken. Followed the steps laid out in #4898 and see the same problem. The problem is that polymorphic_url is mapping to the :show action for that form_for, when it should be mapping to the :create.
Possibly because it's matching /fish/:id, when it should be matching /fish/new?
-
José Valim June 19th, 2010 @ 11:10 PM
- Milestone cleared.
- State changed from resolved to open
- Assigned user changed from josh to José Valim
-
José Valim June 19th, 2010 @ 11:20 PM
- State changed from open to committed
-
José Valim June 19th, 2010 @ 11:20 PM
- no changes were found...
-
Repository June 19th, 2010 @ 11:21 PM
- State changed from committed to resolved
(from [ed3f042e99949526f483d1f567e40031deea33d3]) Make polymorphic_url and scaffolding work with uncountable resources [#3930 state:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/ed3f042e99949526f483d1f567e400...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 3930 Uncountable inflections lead to exception with Rails 3 scaffolding (from [d6190c6dff33dce8e78e82d4a2578df444b46e65]) Add mor...
- 4817 Uncountable inflections routing exception in beta 4 I seem to be having the same problem as described previo...
- 4817 Uncountable inflections routing exception in beta 4 No need to create a new ticket. We can continue discussin...
- 4898 Routing issue with 'uncountable' resources Duplicate of #3930
- 4898 Routing issue with 'uncountable' resources Christoper, I've added a patch to #3930 - check it out an...
- 3930 Uncountable inflections lead to exception with Rails 3 scaffolding (from [ed3f042e99949526f483d1f567e40031deea33d3]) Make po...
- 4226 Possible bug with uncountable inflections and namedspace routes? I believe this bug is different from https://rails.light...
- 3930 Uncountable inflections lead to exception with Rails 3 scaffolding (from [cf6734fdf9d72bfc7fe92e36bf603d67ad815e6b]) Add mor...