Where is the error in this I can't see it:
news = News.find(:all, :conditions => [":simulation_id => session[:sim_id] AND :created_at > session[:last_login]"])
Where is the error in this I can't see it:
news = News.find(:all, :conditions => [":simulation_id => session[:sim_id] AND :created_at > session[:last_login]"])
Try this:
news = News.find(:all, :conditions => ["simulation_id = ? AND created_at > ?", session[:sim_id], session[:last_login]])
Your conditions string won't be evaluated as you expect:
[":simulation_id => session[:sim_id] AND :created_at > session[:last_login]"]
change that to
["simulation_id = ? AND created_at > ?", session[:sim_id], session[:last_login]]
You can also call Model.all
instead of Model.find(:all)
which would look something like this:
news = News.all(:conditions => ["simulation_id = ? AND created_at > ?", session[:sim_id], session[:last_login]])