http://rails.lighthouseapp.com/projects/8994/tickets/408-generating-a-scaffold-resource-named-mr-confuses-breaks-the-generator#ticket-408-1
URL to the ticket....
On Jun 14, 7:49 pm, Matthew Williams
<matthew.d.willi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I had a unique instance where I needed a model called "MRA".
When I
> built my scaffolded resource I get the following:
> --------------------------------
> mwilliams@Danzig:~/Documents/Projects/TestApp$ ruby script/generate
> scaffold MRA
> exists app/models/
> exists app/controllers/
> exists app/helpers/
> create app/views/mr_as
> exists app/views/layouts/
> exists test/functional/
> exists test/unit/
> exists public/stylesheets/
> create app/views/mr_as/index.html.erb
> create app/views/mr_as/show.html.erb
> create app/views/mr_as/new.html.erb
> create app/views/mr_as/edit.html.erb
> create app/views/layouts/mr_as.html.erb
> create public/stylesheets/scaffold.css
> create app/controllers/mr_as_controller.rb
> create test/functional/mr_as_controller_test.rb
> create app/helpers/mr_as_helper.rb
> route map.resources :mr_as
> dependency model
> exists app/models/
> exists test/unit/
> exists test/fixtures/
> create app/models/mra.rb
> create test/unit/mra_test.rb
> create test/fixtures/mras.yml
> create db/migrate
> create db/migrate/20080614234404_create_mras.rb
> mwilliams@Danzig:~/Documents/Projects/TestApp$
> -------------------------
>
> Notice how it handled the controller and views file names. It split
> the name of the Model because (I''m making an assumption) that
it''s
> treating the model like a name. So "Mr." or "Mrs.".
>
> What''s worse, is if I try to continue working, I can''t
create any more
> scaffolded resources
>
> ----------------
> mwilliams@Danzig:~/Documents/Projects/TestApp$ ruby script/generate
> scaffold Product
> /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/
> dependencies.rb:261:in `load_missing_constant'': Expected /home/
> mwilliams/Documents/Projects/TestApp/app/helpers/mr_as_helper.rb to
> define MrAsHelper (LoadError)
> from /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/
> active_support/dependencies.rb:467:in `const_missing''
> from /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/
> active_support/dependencies.rb:479:in `const_missing''
> from /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/
> active_support/inflector.rb:283:in `constantize''
> from /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/
> active_support/core_ext/string/inflections.rb:143:in `constantize''
> from /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
> action_controller/helpers.rb:133:in `helper''
> from /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
> action_controller/helpers.rb:111:in `each''
> from /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
> action_controller/helpers.rb:111:in `helper''
> from /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
> action_controller/helpers.rb:116:in `helper''
> ... 27 levels...
> from
/usr/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/commands/generate.rb:
> 1
> from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in
> `gem_original_require''
> from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in
> `require''
> from script/generate:3
> mwilliams@Danzig:~/Documents/Projects/TestApp$
> --------------------------------
>
> It even breaks migrations:
> ----------------------------
> mwilliams@Danzig:~/Documents/Projects/TestApp$ rake db:migrate
> (in /home/mwilliams/Documents/Projects/TestApp)
> rake aborted!
> Expected /home/mwilliams/Documents/Projects/TestApp/app/helpers/
> mr_as_helper.rb to define MrAsHelper
> ---------------------------
>
> Is this a bug or is it breaking convention creating a model of all
> capital letters (thought my case for creating an MRA model seems
> legit).
>
> I''ve created a ticket for the bug. Feel free to chime in or build
a
> patch (I may attempt to do so).
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---