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...
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---