I might be doing this in the ''wrong way'' but I''m trying to post to two different tables from one method using: def new @variable1 = Variable1.new @variable2 = Variable2.new end However, this gives me an error: uninitialized constant Variable2 I have defined a model for Variable2, and I thought that this method should recognise that. Am I doing this wrong??? _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Scott Arthur wrote:> I might be doing this in the ''wrong way'' but I''m trying to post to two > different tables from one method using: > > def new > @variable1 = Variable1.new > @variable2 = Variable2.new > end > > However, this gives me an error: > > uninitialized constant Variable2 > > I have defined a model for Variable2, and I thought that this method > should recognise that. Am I doing this wrong???I''ll bet your controller contains model :variable1 but not model :variable2
It actually doesn''t have any lines like that, it''s a generated scaffold controller. I tried adding model :variable1 model :variable2 to the top of the controller and I''m still getting the unitialized constant error? On 24/08/2005, at 12:19 PM, Steve Downey wrote:> Scott Arthur wrote: > > >> I might be doing this in the ''wrong way'' but I''m trying to post to >> two different tables from one method using: >> >> def new >> @variable1 = Variable1.new >> @variable2 = Variable2.new >> end >> >> However, this gives me an error: >> >> uninitialized constant Variable2 >> I have defined a model for Variable2, and I thought that this >> method should recognise that. Am I doing this wrong??? >> > > > I''ll bet your controller contains > > model :variable1 > > but not > > model :variable2 > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >