rubyonrails-c4f1mTqwXZkdnm+yROfE0A@public.gmane.org
2004-Nov-25 07:10 UTC
gem rails 1.1.0.200411231446 flags has_many error
Hi I updated gem rails today and saw that rails had an update. With the new edition, I get a warning statement printed that was not in the two earlier versions. (No message with either: require_gem ''activerecord'', "= 1.0.0" require_gem ''activerecord'', "= 1.0.0.20041114" ) The code still works, but the warning makes no sense. Plus, it cannot be turned of just by skipping the ''-w'' flag on the shebang line. The two tables I have are: CREATE TABLE `people` ( `id` int(11) NOT NULL auto_increment, `name` varchar(20) NOT NULL default ''"'', PRIMARY KEY (`id`) ) TYPE=MyISAM; CREATE TABLE `pets` ( `id` int(11) NOT NULL auto_increment, `name` varchar(20) default NULL, `kind` varchar(30) default NULL, `person_id` int(11) default NULL, PRIMARY KEY (`id`) ) TYPE=MyISAM; The error is caused by the following: class Person < ActiveRecord::Base has_many :pets end # prints # Person failed to require Pet class Pet < ActiveRecord::Base belongs_to :person end # prints # Pet failed to require Person Am I missing something? -- Jim Freeze Code Red. Code Ruby
David Heinemeier Hansson
2004-Nov-25 21:37 UTC
Re: gem rails 1.1.0.200411231446 flags has_many error
> The error is caused by the following: > > class Person < ActiveRecord::Base > has_many :pets > end > # prints > # Person failed to require Pet > > class Pet < ActiveRecord::Base > belongs_to :person > end > # prints > # Pet failed to require Person > > Am I missing something?In the beta gems, the associations will attempt to require the models they need on their own. This automated requiring expects each model to be in its own file and be named model.rb. So if that''s not the case for you, you''ll get a warning. -- David Heinemeier Hansson, http://www.basecamphq.com/ -- Web-based Project Management http://www.rubyonrails.org/ -- Web-application framework for Ruby http://macromates.com/ -- TextMate: Code and markup editor (OS X) http://www.loudthinking.com/ -- Broadcasting Brain