logo       

[Rails] NoMethodError (undefined method `[]' for nil:NilClass): msg#03240

RubyonRailsTalk

Subject: [Rails] NoMethodError (undefined method `[]' for nil:NilClass)


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

Please help

--~--~---------~--~----~------------~-------~--~----~
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@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@xxxxxxxxxxxxxxxx
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | Mail Home | sitemap | FAQ | advertise