> I created model named "whats_new".
>
> $ script/generate model whats_new
>      exists  app/models/
>      exists  test/unit/
>      exists  test/fixtures/
>      create  app/models/whats_new.rb
>      create  test/unit/whats_new_test.rb
>      create  test/fixtures/whats_news.yml
>      exists  db/migrate
>      create  db/migrate/*****_create_whats_news.rb
>
> -----
>
> rake db:migrate
> WhatsNew.find()
> WhatsNew.new
>
> There are no problem.
>
> However,
> test/unit/whats_new_test.rb
> -----------------
> whats_news(:data1)
> -----------------
> => "No class attached to find."
>
> -----------------------------------------------
> class Fixtures
> ...
> ...
> def initialize
> ...
> @class_name = class_name ||
>                  (ActiveRecord::Base.pluralize_table_names ?
> @table_name.singularize.camelize : @table_name.camelize)
> p @class_name
> ...
> end
> end
> -----------------------------------------------
> => "WhatsNews"
> A true class name is "WhatsNew".
>
> @table_name == "whats_news"
>
>>> "whats_news".singularize.camelize
> => "WhatsNews"
>>> "whats_new".pluralize.singularize
> => "whats_news"
>
> By the way, I cannot speak English...

In english, 'news' is both singular and plural.  A single news item is  
still called 'news' not 'new'.

Two choices for you..

- Add your own inflection so that 'news' is singularlized to 'news'.
- Change your class name.

-philip



--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to