开发者

Rails3: Find method not working with fixtures in test environment

开发者 https://www.devze.com 2023-01-18 09:27 出处:网络
The Rails Guide says, \"Fixtures can also transform themselves into the form of the original class. Thus, you can get at the methods only available to that class,\" and gives the example,

The Rails Guide says, "Fixtures can also transform themselves into the form of the original class. Thus, you can get at the methods only available to that class," and gives the example,

# using the find method, we grab the "real" david as a User 
david = users(:david).find 

My fixtures a开发者_运维知识库re working ok, but when I try

    memb = members(:one).find

I get an error: NoMethodError: undefined method `find'. What am I doing wrong?

(Rails Guide reference: http://edgeguides.rubyonrails.org/testing.html#the-low-down-on-fixtures)


The guide is fixed now, and find is not necessary anymore because now users(:david) is the ActiveRecord object.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号