一切似乎都在開發和生產環境以及工作正確處理空值:所以Rails的ActiveRecord的似乎並沒有在測試enviornment
> script/console Loading development environment (Rails 2.3.8) ruby-1.8.7-p302 > Tape.find(:first, :conditions => "deleted_at is not null").deleted_at.nil? => false ruby-1.8.7-p302 > Tape.find(:first, :conditions => "deleted_at is null").deleted_at.nil? => true
爲什麼當我在測試環境完全相反的結果?
> script/console test Loading test environment (Rails 2.3.8) ruby-1.8.7-p302 > Tape.find(:first, :conditions => "deleted_at is not null").deleted_at.nil? => true
搜索deleted_at is null
永遠不會返回在測試環境中的任何記錄,甚至當一些呼叫具有deleted_at = nil
和一些有一個時間戳那裏。
這裏的mysql表的部分讀出:
mysql> describe tapes; +-----------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-----------------+--------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | ... | deleted_at | datetime | YES | | NULL | | +-----------------+--------------+------+-----+---------+----------------+
有誰知道這是怎麼回事?這是一個錯誤?
偉大的想法,但是,他們都是mysql:/ – muirbot 2011-05-13 17:57:47