I am trying to setup my data model so I have 3 tables ... Suite, Case, Result A suite will have multiple cases Each Case will have multiple results. I tried to do this with class Suite < ActiveRecord::Base has_many :cases end class Case < ActiveRecord::Base belongs_to :suite has_many :results end class Result < ActiveRecord::Base belongs_to :case end In my controllers #index I did @suites = Suite.find( :all, :order => ''name ASC'' ) When requesting the page I get syntax error on belongs_to What am I doing wrong? -- "http://ruby-lang.org -- do you ruby?" Jeff Wood _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On Oct 11, 2005, at 12:51 PM, Jeff Wood wrote:> In my controllers #index I did @suites = Suite.find( :all, :order > => ''name ASC'' ) > > When requesting the page I get syntax error on belongs_to > > What am I doing wrong?case is a reserved language word. Try changing the name of that Relation (and the relationships associated with it) and see if that changes anything.
Isn''t "case" a reserved keyword in Ruby? On 10/11/05, Jeff Wood <jeff.darklight-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I am trying to setup my data model so I have 3 tables ... > > Suite, Case, Result > > A suite will have multiple cases > Each Case will have multiple results. > > I tried to do this with > > class Suite < ActiveRecord::Base > has_many :cases > end > > class Case < ActiveRecord::Base > belongs_to :suite > has_many :results > end > > class Result < ActiveRecord::Base > belongs_to :case > end > > In my controllers #index I did @suites = Suite.find( :all, :order => ''name > ASC'' ) > > When requesting the page I get syntax error on belongs_to > > What am I doing wrong? > > > -- > "http://ruby-lang.org -- do you ruby?" > > Jeff Wood > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >
On Oct 11, 2005, at 17:17, Cuong Tran wrote:> Isn''t "case" a reserved keyword in Ruby? >yep: __FILE__ and def end in or self unless __LINE__ begin defined? ensure module redo super until BEGIN break do false next rescue then when END case else for nil retry true while alias class elsif if not return undef yield
Looks like things were actually blowing up because of an error in my .rhtml file for that view. ... But thanks for the help ... I was aware that "case" is a reserved word. I wasn''t using "case" I was using either Case ( my class name ) or "case_obj" for instances of that class... Anyways, It wasn''t an issue ... but thanks for voicing your concerns... j. On 10/11/05, Caio Chassot <k@v2studio.com> wrote:> > > On Oct 11, 2005, at 17:17, Cuong Tran wrote: > > > Isn''t "case" a reserved keyword in Ruby? > > > > yep: > > __FILE__ and def end in or self unless __LINE__ begin defined? ensure > module redo super until BEGIN break do false next rescue then when END > case else for nil retry true while alias class elsif if not return > undef yield > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- "http://ruby-lang.org -- do you ruby?" Jeff Wood _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails