Larry Kelly
2005-Jun-30 15:40 UTC
undefined method ''[]'' for nil:NilClass on SQL Server (mssql) using ADO.rb
I have Rails installed on Several Windows platforms (XP, 2000,2003), All are running MS SQL SERVER 2000. I have installed the ADO.rb file according to the RoR site insructions. Host name and passwords are correct ( I tested by inserting bad password and got an error message from the ADO adapter). All seems correct. But, when I start WEBrick and go '' http://localhost:3000/my_controller_name(s)'', all I get is this error message: NoMethodError in Categories#index undefined method `[]'' for nil:NilClass app/controllers/categories_controller.rb:8:in `list'' app/controllers/categories_controller.rb:3:in `index'' script/server:48 Anyone have an idea how to fix this issue? Thanks -Larry _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Michael Campbell
2005-Jun-30 18:54 UTC
Re: undefined method ''[]'' for nil:NilClass on SQL Server (mssql) using ADO.rb
W/o seeing your code, I can only guess. But it appears that you have some array (or what you think is an array) that you''re trying to index, but it''s nil. What''s line 8 look like in your controller? On 6/30/05, Larry Kelly <ldk2005-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have Rails installed on Several Windows platforms (XP, 2000,2003), All are > running MS SQL SERVER 2000. I have installed the ADO.rb file according to > the RoR site insructions. Host name and passwords are correct ( I tested by > inserting bad password and got an error message from the ADO adapter). All > seems correct. But, when I start WEBrick and go > ''http://localhost:3000/my_controller_name(s)'', all I get is > this error message: > > > NoMethodError in Categories#index undefined method `[]'' for nil:NilClass > app/controllers/categories_controller.rb:8:in `list'' > app/controllers/categories_controller.rb:3:in `index'' > script/server:48 > > Anyone have an idea how to fix this issue? > > Thanks > -Larry > > > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >
Larry Kelly
2005-Jun-30 22:32 UTC
Re: undefined method ''[]'' for nil:NilClass on SQL Server (mssql) using ADO.rb
Here are the relevant lines: 7 def list 8 @category_pages, @categories = paginate :category, :per_page => 10 9 end --Larry On 6/30/05, Michael Campbell <michael.campbell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > W/o seeing your code, I can only guess. But it appears that you have > some array (or what you think is an array) that you''re trying to > index, but it''s nil. > > What''s line 8 look like in your controller? > > > On 6/30/05, Larry Kelly <ldk2005-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > I have Rails installed on Several Windows platforms (XP, 2000,2003), All > are > > running MS SQL SERVER 2000. I have installed the ADO.rb file according > to > > the RoR site insructions. Host name and passwords are correct ( I tested > by > > inserting bad password and got an error message from the ADO adapter). > All > > seems correct. But, when I start WEBrick and go > > ''http://localhost:3000/my_controller_name(s)'', all I get is > > this error message: > > > > > > NoMethodError in Categories#index undefined method `[]'' for nil:NilClass > > app/controllers/categories_controller.rb:8:in `list'' > > app/controllers/categories_controller.rb:3:in `index'' > > script/server:48 > > > > Anyone have an idea how to fix this issue? > > > > Thanks > > -Larry > > > > > > > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Larry Kelly
2005-Jul-01 02:57 UTC
Re: undefined method ''[]'' for nil:NilClass on SQL Server (mssql) using ADO.rb
There shouldn''t be. It''s standard scaffold generated code. It works as written on MySQL. The problem appears to be with pagination, but I don''t know where. Or what to change to make pagination work with SqlServer. I can make the error go away by removing the pagination like this: def list @categories = Category.find(:all, :order_by "name ASC") end That validates the rest of the code, but doesn''t solve the problem. -Larry On 6/30/05, Michael Campbell <michael.campbell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I''m baffled, sorry. Nothing in that line leads me to believe the > problem is your code, given the error message you have. =\ > > On 6/30/05, Larry Kelly <ldk2005-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Here are the relevant lines: > > > > 7 def list > > 8 @category_pages, @categories = paginate :category, :per_page => 10 > > 9 end > > > > --Larry > > > > > > On 6/30/05, Michael Campbell <michael.campbell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > W/o seeing your code, I can only guess. But it appears that you have > > > some array (or what you think is an array) that you''re trying to > > > index, but it''s nil. > > > > > > What''s line 8 look like in your controller? > > > > > > > > > On 6/30/05, Larry Kelly <ldk2005-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > I have Rails installed on Several Windows platforms (XP, 2000,2003), > All > > are > > > > running MS SQL SERVER 2000. I have installed the ADO.rb file > according > > to > > > > the RoR site insructions. Host name and passwords are correct ( I > > tested by > > > > inserting bad password and got an error message from the ADO > adapter). > > All > > > > seems correct. But, when I start WEBrick and go > > > > ''http://localhost:3000/my_controller_name(s)'', all I > > get is > > > > this error message: > > > > > > > > > > > > NoMethodError in Categories#index undefined method `[]'' for > > nil:NilClass > > > > app/controllers/categories_controller.rb:8:in `list'' > > > > app/controllers/categories_controller.rb:3:in `index'' > > > > script/server:48 > > > > > > > > Anyone have an idea how to fix this issue? > > > > > > > > Thanks > > > > -Larry > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > Rails mailing list > > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Ken Barker
2005-Jul-01 03:09 UTC
Re: undefined method ''[]'' for nil:NilClass on SQL Server (mssql) using ADO.rb
See ticket #1044 on the Rails Trac. It involves patching a line in the pagination.rb. It has worked for me, but I do not know if the patch will break the other databases. Ken On 6/30/05, Larry Kelly <ldk2005-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > There shouldn''t be. It''s standard scaffold generated code. It works as > written on MySQL. The problem appears to be with pagination, but I don''t > know where. Or what to change to make pagination work with SqlServer. I can > make the error go away by removing the pagination like this: > > def list > @categories = Category.find(:all, :order_by "name ASC") > end > > That validates the rest of the code, but doesn''t solve the problem. > -Larry > > On 6/30/05, Michael Campbell <michael.campbell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > I''m baffled, sorry. Nothing in that line leads me to believe the > > problem is your code, given the error message you have. =\ > > > > On 6/30/05, Larry Kelly <ldk2005-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Here are the relevant lines: > > > > > > 7 def list > > > 8 @category_pages, @categories = paginate :category, :per_page => 10 > > > 9 end > > > > > > --Larry > > > > > > > > > On 6/30/05, Michael Campbell < michael.campbell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > W/o seeing your code, I can only guess. But it appears that you have > > > > some array (or what you think is an array) that you''re trying to > > > > index, but it''s nil. > > > > > > > > What''s line 8 look like in your controller? > > > > > > > > > > > > On 6/30/05, Larry Kelly <ldk2005-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > wrote: > > > > > I have Rails installed on Several Windows platforms (XP, > > 2000,2003), All > > > are > > > > > running MS SQL SERVER 2000. I have installed the ADO.rb file > > according > > > to > > > > > the RoR site insructions. Host name and passwords are correct ( I > > > tested by > > > > > inserting bad password and got an error message from the ADO > > adapter). > > > All > > > > > seems correct. But, when I start WEBrick and go > > > > > ''http://localhost:3000/my_controller_name(s)<http://localhost:3000/my_controller_name%28s%29>'', > > all I > > > get is > > > > > this error message: > > > > > > > > > > > > > > > NoMethodError in Categories#index undefined method `[]'' for > > > nil:NilClass > > > > > app/controllers/categories_controller.rb:8:in `list'' > > > > > app/controllers/categories_controller.rb:3:in `index'' > > > > > script/server:48 > > > > > > > > > > Anyone have an idea how to fix this issue? > > > > > > > > > > Thanks > > > > > -Larry > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rails mailing list > > > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > Rails mailing list > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Larry Kelly
2005-Jul-01 15:00 UTC
Re: undefined method ''[]'' for nil:NilClass on SQL Server (mssql) using ADO.rb
I went to: http://dev.rubyonrails.com/ticket/1044 Applied the change to line sqlserver_adapter.rb #292. Basically it was replacing :nil with ["id ASC", "id DESC"]. Very simple. Pagination now works with alternate Order_by clause as well. -Larry On 6/30/05, Ken Barker <ken.barker-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > See ticket #1044 on the Rails Trac. It involves patching a line in the > pagination.rb. It has worked for me, but I do not know if the patch will > break the other databases. > > Ken > > On 6/30/05, Larry Kelly <ldk2005-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > There shouldn''t be. It''s standard scaffold generated code. It works as > > written on MySQL. The problem appears to be with pagination, but I don''t > > know where. Or what to change to make pagination work with SqlServer. I can > > make the error go away by removing the pagination like this: > > > > def list > > @categories = Category.find(:all, :order_by "name ASC") > > end > > > > That validates the rest of the code, but doesn''t solve the problem. > > -Larry > > > > On 6/30/05, Michael Campbell < michael.campbell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > I''m baffled, sorry. Nothing in that line leads me to believe the > > > problem is your code, given the error message you have. =\ > > > > > > On 6/30/05, Larry Kelly < ldk2005-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Here are the relevant lines: > > > > > > > > 7 def list > > > > 8 @category_pages, @categories = paginate :category, :per_page => 10 > > > > 9 end > > > > > > > > --Larry > > > > > > > > > > > > On 6/30/05, Michael Campbell < michael.campbell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > W/o seeing your code, I can only guess. But it appears that you > > > have > > > > > some array (or what you think is an array) that you''re trying to > > > > > index, but it''s nil. > > > > > > > > > > What''s line 8 look like in your controller? > > > > > > > > > > > > > > > On 6/30/05, Larry Kelly < ldk2005-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > wrote: > > > > > > I have Rails installed on Several Windows platforms (XP, > > > 2000,2003), All > > > > are > > > > > > running MS SQL SERVER 2000. I have installed the ADO.rb file > > > according > > > > to > > > > > > the RoR site insructions. Host name and passwords are correct ( > > > I > > > > tested by > > > > > > inserting bad password and got an error message from the ADO > > > adapter). > > > > All > > > > > > seems correct. But, when I start WEBrick and go > > > > > > ''http://localhost:3000/my_controller_name(s)<http://localhost:3000/my_controller_name%28s%29>'', > > > all I > > > > get is > > > > > > this error message: > > > > > > > > > > > > > > > > > > NoMethodError in Categories#index undefined method `[]'' for > > > > nil:NilClass > > > > > > app/controllers/categories_controller.rb:8:in `list'' > > > > > > app/controllers/categories_controller.rb:3:in `index'' > > > > > > script/server:48 > > > > > > > > > > > > Anyone have an idea how to fix this issue? > > > > > > > > > > > > Thanks > > > > > > -Larry > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > Rails mailing list > > > > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > Rails mailing list > > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails