as staed in the API, I am loading fixtures into a table : rake db:fixtures:load FIXTURES=ecourses without specifying the id in a simple has_many/belongs_to association, and I get an ''unknow column'' error for the foreign_key... if I change the FK to a label interpolation, then I got it running well.... I am using the following tset code : Models-------------- class Epath < ActiveRecord::Base has_many :ecourses end class Ecourse < ActiveRecord::Base belongs_to :epath end Fixtures--------------- # epaths complexPath: name: Complex One # ecourses.yml curabitur: name: Curabitur epath: complexPath error : Mysql::Error: Unknown column ''epath'' in ''field list'' : INSERT INTO `ecourses` (`epath`,...... BUT if I modify the Fixtures # ecourses.yml curabitur: name: Curabitur epath_id: <%= Fixtures.identify(:complexPath) %> then I got it done .... what''s wrong in my code ? tfyh erwin
gregory.mazurek-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2009-Oct-08 12:29 UTC
Re: Rails fixtures load not working as stated (2.3.4)
ha sounds good. bring a bottle of water so you dont have to buy a drink there ----- www.abetaday.com ------Original Message------ From: Erwin <yves_dufour-ee4meeAH724@public.gmane.org> To: "Ruby on Rails: Talk" <rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Date: Thu, Oct 8, 3:06 AM -0700 Subject: [Rails] Rails fixtures load not working as stated (2.3.4) as staed in the API, I am loading fixtures into a table : rake db:fixtures:load FIXTURES=ecourses without specifying the id in a simple has_many/belongs_to association, and I get an ''unknow column'' error for the foreign_key... if I change the FK to a label interpolation, then I got it running well.... I am using the following tset code : Models-------------- class Epath < ActiveRecord::Base has_many :ecourses end class Ecourse < ActiveRecord::Base belongs_to :epath end Fixtures--------------- # epaths complexPath: name: Complex One # ecourses.yml curabitur: name: Curabitur epath: complexPath error : Mysql::Error: Unknown column ''epath'' in ''field list'' : INSERT INTO `ecourses` (`epath`,...... BUT if I modify the Fixtures # ecourses.yml curabitur: name: Curabitur epath_id: <%= Fixtures.identify(:complexPath) %> then I got it done .... what''s wrong in my code ? tfyh erwin
I only drink ''Chouchenn'' found a hint : it runs well when specifying the foreign_key and class_name belongs_to :epath, :foreign_key => "epath_id", :class_name => "Epath" never when using only belongs_to ?? On 8 oct, 14:29, "gregory.mazu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <gregory.mazu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> ha sounds good. bring a bottle of water so you dont have to buy a drink there > > -----www.abetaday.com > > ------Original Message------ > From: Erwin <yves_duf...-ee4meeAH724@public.gmane.org> > To: "Ruby on Rails: Talk" <rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > Date: Thu, Oct 8, 3:06 AM -0700 > Subject: [Rails] Rails fixtures load not working as stated (2.3.4) > > as staed in the API, I am loading fixtures into a table : > > rake db:fixtures:load FIXTURES=ecourses without specifying the id in > a simple has_many/belongs_to association, and I get an ''unknow > column'' error for the foreign_key... > if I change the FK to a label interpolation, then I got it running > well.... > > I am using the following tset code > : > Models-------------- > class Epath < ActiveRecord::Base > has_many :ecourses > end > > class Ecourse < ActiveRecord::Base > belongs_to :epath > end > > Fixtures--------------- > # epaths > complexPath: > name: Complex One > > # ecourses.yml > curabitur: > name: Curabitur > epath: complexPath > > error : Mysql::Error: Unknown column ''epath'' in ''field list'' : INSERT > INTO `ecourses` (`epath`,...... > > BUT if I modify the Fixtures > > # ecourses.yml > curabitur: > name: Curabitur > epath_id: <%= Fixtures.identify(:complexPath) %> > > then I got it done .... > > what''s wrong in my code ? > > tfyh > > erwin
Gregory Mazurek
2009-Oct-08 17:47 UTC
Re: Rails fixtures load not working as stated (2.3.4)
my apologies for this spam on my part - for some reason, my cell phone had been sms-ing replies to my emails. Apologies again. btw, Chouchenn is fantastic. Unfortunately, Erwin, I don''t yet see the problem with your code yet. If you post more, I may be able to assist as I feel obligated! cheers, Greg On Thu, Oct 8, 2009 at 8:29 AM, gregory.mazurek-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org < gregory.mazurek-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> ha sounds good. bring a bottle of water so you dont have to buy a drink > there > > ----- > www.abetaday.com > > ------Original Message------ > From: Erwin <yves_dufour-ee4meeAH724@public.gmane.org> > To: "Ruby on Rails: Talk" <rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > Date: Thu, Oct 8, 3:06 AM -0700 > Subject: [Rails] Rails fixtures load not working as stated (2.3.4) > > > as staed in the API, I am loading fixtures into a table : > > rake db:fixtures:load FIXTURES=ecourses without specifying the id in > a simple has_many/belongs_to association, and I get an ''unknow > column'' error for the foreign_key... > if I change the FK to a label interpolation, then I got it running > well.... > > I am using the following tset code > : > Models-------------- > class Epath < ActiveRecord::Base > has_many :ecourses > end > > class Ecourse < ActiveRecord::Base > belongs_to :epath > end > > Fixtures--------------- > # epaths > complexPath: > name: Complex One > > # ecourses.yml > curabitur: > name: Curabitur > epath: complexPath > > error : Mysql::Error: Unknown column ''epath'' in ''field list'' : INSERT > INTO `ecourses` (`epath`,...... > > BUT if I modify the Fixtures > > # ecourses.yml > curabitur: > name: Curabitur > epath_id: <%= Fixtures.identify(:complexPath) %> > > then I got it done .... > > what''s wrong in my code ? > > tfyh > > erwin > > > > > > > >-- www.abetaday.com --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---