Rails ActiveRecord query fails to find record in a class module -
i have rails class within module
module test class < activerecord::base end end
im facing problems querying model
the following queries work fine, conforming model connection database perfect
test::a.all.size test::a.first test::a.find(1)
however when activerecord find error
test::a.find(:first, :conditions => {:id => 1}) activerecord::recordnotfound: couldn't find test::as 'id': (first, {:conditions=>{:id=>1}}) (found 0 results, looking 2)
what seems problem? wrong way query class inside module?
this activerecord query format not available, deprecated , dropped time ago, query run either
test::a.find(1)
or
test::a.where(:id => 1).first
or
test::a.find_by(:id => 1)
Comments
Post a Comment