Welcome to Working With Rails

 

Discussion Forums

Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
rails 3 sometimes fails on inherited model find() qeury as type=0
1 Post
rails 3 sometimes fails on inherited model find() qeury as type=0

rails 3 sometimes fails on inherited model find() qeury as type=0

Example : class Student < ActiveRecord::Base end

class SrStudent < Student end

class JrStudent < Student end

JrStudent.find(:all, :conditions => ["status=1"]) or SrStudent.find(:all, :conditions => ["status=1"])

Log query seems like : SELECT students.* FROM students WHERE students.type = 0 AND (students.status = 1)

In that query it auto set type=0 instead of its relevant class name.

These same contents was working fine with rails 2.3.8

NOTE:It sometimes fails on rails 3 like with above query, not every time!

Any suggestion ??

-Ganesh K

Person
Jruby, Ruby, Rails Programmer
Sign In To Rate Post
1 Post
Login to add your message