I am very new at programming RoR and hope you can help me on this issue. I got the following error after deployment (production.log):
Processing HomeController#index (for 70.79.130.36 at 2007-11-12 02:01:53) [GET]
Session ID: 27122fd55a71d37498e1b1afedeb01fd
Parameters: {"action"=>"index", "controller"=>"home"}
NoMethodError (undefined method `[]' for nil:NilClass):
/home/railste/eventonrails2/app/controllers/home_controller.rb:12:in `list'
/home/railste/eventonrails2/app/controllers/home_controller.rb:5:in `index'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/base.rb:1101:in `send'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/base.rb:1101:in `perform_action_without_filters'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/filters.rb:696:in `call_filters'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/filters.rb:688:in `perform_action_without_benchmark'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/benchmarking.rb:66:in `perform_action_without_rescue'
/usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/benchmarking.rb:66:in `perform_action_without_rescue'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/rescue.rb:83:in `perform_action'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/base.rb:435:in `send'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/base.rb:435:in `process_without_filters'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/filters.rb:684:in `process_without_session_management_support'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/session_management.rb:114:in `process'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/base.rb:334:in `process'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/dispatcher.rb:41:in `dispatch'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/fcgi_handler.rb:168:in `process_request'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/fcgi_handler.rb:143:in `process_each_request!'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/fcgi_handler.rb:109:in `with_signal_handler'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/fcgi_handler.rb:142:in `process_each_request!'
/usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:612:in `each_cgi'
/usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:609:in `each'
/usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:609:in `each_cgi'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/fcgi_handler.rb:141:in `process_each_request!'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/fcgi_handler.rb:55:in `process!'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/fcgi_handler.rb:25:in `process!'
dispatch.fcgi:24
The following code is "home_controller.rb":
class HomeController < ApplicationController
before_filter :public_province
def index
list
render :action => 'list'
end
def list
# today's events
today_date = Time.now
@today_event_pages, @today_events = paginate :events, :order => 'start_date', :conditions => ["is_approved = 1 and is_active = 1 and is_expired = 0 and province_id = ? and start_date < ? and end_date > ?", session[:province][:id], today_date, today_date], :per_page => 2
end
end
I am not sure if this is caused by the session, or filter, or database settings. Any comments is appreciated :-)
Thank you.