2009/7/31 seenu <[email protected]>: > > Hi everyone this is the error that's been killing me, please tell > where i am missing. > I have upgraded my rails version from 1.2.3 to 2.3.2 and have > installed active_scaffold plugin, since then this error started which > was not there in older version. > > This is the log output: > > Processing AccountController#consumer_home (for 122.167.8.236 at > 2009-07-31 09:02:22) [GET] > > NoMethodError (undefined method `[]' for nil:NilClass): > app/controllers/account_controller.rb:566:in `paginate_by_sql' > app/controllers/account_controller.rb:623:in `consumer_home' > Rendering /home/v8354a/public_html/projectbidding/public/500.html (500 > Internal Server Error) > > I have paginate_by_sql function in application_controller.rb file > which is shown below will call Paginator class. > > def paginate_by_sql(model, sql, per_page, options={}) > if options[:count] > if options[:count].is_a? Integer > total = options[:count] > else > total = model.count_by_sql(options[:count]) > end > else > total = model.count_by_sql_wrapping_select_query(sql) > end > object_pages = Paginator.new self, total, per_page, @params > ['page'] > objects = model.find_by_sql_with_limit(sql, > object_pages.current.to_sql[1], per_page) > return [object_pages, objects] > end >
You have not told us which is line 566 which is where the error is. Looking at the code though I guess it is one of the lines containing options[:count] or maybe @params['page']. The error is undefined method `[]' for nil:NilClass which would suggest that maybe options or params is not set. If you can't see the problem by inspecting the code you could try using ruby-debug to break in at the appropriate point and have a look at what is going on. The rails guide on testing applications is good. Colin --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

