This project is archived and is in readonly mode.
Problems with scaffolding of subclasses
-
Brandon Palmen
Could the invalid xml problem be solved by changing to <foo:bars> as such?
# File vendor/rails/activesupport/lib/active_support/core_ext/array/conversions.rb, line 153 options[:root] ||= all? { |e| e.is_a?(first.class) && first.class.to_s != "Hash" } ? first.class.to_s.split('::').collect{|c| c.underscore}.join(':').pluralize : "records" -
Brian Rose
- Assigned user set to Ryan Bigg
Bug replicated in 2.3.5 and 3.0. "rails g scaffold Foo::Bar" produces:
class Foo::BarsController < ApplicationController # GET /foo_bars # GET /foo_bars.xml def index @foo_bars = Foo::Bar.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @foo_bars } end end # GET /foo_bars/1 # GET /foo_bars/1.xml def show @bar = Foo::Bar.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @bar } end end ... end -
Brian Rose
Same line in routes.rb when using 'rails g resource ...'.
-
Brian Rose
- Tag changed from 2.3, scaffold, scaffolding, sub-resource, xml to 2.3, 3.0, scaffold, scaffolding, sub-resource, xml
Same line in routes.rb when using 'rails g resource ...'.
-
Ryan Bigg
- Assigned user cleared.
I resolve myself of all responsibility of fixing things. I am only a ticket rustler. This does look like an enjoyable ticket though, perhaps I'll use it as an example for Railscamp.
-
Ryan Bigg
- Milestone cleared.
I get valid XML for this:
<?xml version=\"1.0\" encoding=\"UTF-8\"?> <foo-bars type=\"array\"> <foo-bar> <created-at type=\"datetime\">2010-04-12T02:33:38Z</created-at> <id type=\"integer\">1</id> <updated-at type=\"datetime\">2010-04-12T02:33:38Z</updated-at> </foo-bar> </foo-bars>But I can confirm the routes and controllers issues.
The Controller
Perhaps for this, we should use a singularized version of table_name? I cannot even work out where file_name is coming from on this one.
The Routes
This is quite trivial. The code in the resource generator currently stands at:
def add_resource_route return if options[:actions].present? route "resource#{:s unless options[:singleton]} :#{pluralize?(file_name)}" endWhich quite obviously doesn't account for namespace routing at all, which I would say is a high priority "fix this before the Release Candidate or else it not be worth calling it a 'Release Candidate'" type of issue. Patches very much welcome on this.
-
Francesc Esplugas
Here's an initial work for the scaffold templates.
-
DHH
- Milestone cleared.
-
Ryan Bigg
- Importance changed from High to Medium
-
Santiago Pastorino
- State changed from new to open
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
Santiago Pastorino
- State changed from open to stale
