开发者

Rails3: Find method not working with fixtures in test environment

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜