gpt4 book ai didi

unit-testing - Rails3 : Find method not working with fixtures in test environment

转载 作者:行者123 更新时间:2023-12-01 04:15:57 25 4
gpt4 key购买 nike

Rails 指南说,“Fixtures 也可以将自己转换成原始类的形式。因此,您可以获得仅对该类可用的方法,”并给出了示例,

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

我的灯具工作正常,但是当我尝试时
    memb = members(:one).find

我收到一个错误:NoMethodError: undefined method `find'。我究竟做错了什么?

(Rails 指南引用: http://edgeguides.rubyonrails.org/testing.html#the-low-down-on-fixtures)

最佳答案

该指南现已修复,不再需要查找,因为现在 users(:david)是 ActiveRecord 对象。

关于unit-testing - Rails3 : Find method not working with fixtures in test environment,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3812321/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com