true)-6ren">
gpt4 book ai didi

ActiveRecord 创建 without_protection - 参数数量错误(2 为 1)

转载 作者:行者123 更新时间:2023-12-05 00:26:39 26 4
gpt4 key购买 nike

我无法弄清楚我的用户模型上的这个 create 语句有什么问题:

User.create({first_name: "Alan",....}, :without_protection => true)

给我堆栈跟踪:
ArgumentError: wrong number of arguments (2 for 1)
from /Users/alanheppenstall/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-4.0.0/lib/active_record/persistence.rb:32:in `create'
from (irb):56
from /Users/alanheppenstall/.rvm/gems/ruby-1.9.3-p362/gems/railties-4.0.0/lib/rails/commands/console.rb:90:in `start'
from /Users/alanheppenstall/.rvm/gems/ruby-1.9.3-p362/gems/railties-4.0.0/lib/rails/commands/console.rb:9:in `start'
from /Users/alanheppenstall/.rvm/gems/ruby-1.9.3-p362/gems/railties-4.0.0/lib/rails/commands.rb:64:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'

我的语法匹配: http://apidock.com/rails/ActiveRecord/Base/create/class/

我正在使用带有此模型的设计 - 这可能是一个问题吗?我找不到他们覆盖 initialize() 的任何地方。

谢谢!

最佳答案

关于ActiveRecord 创建 without_protection - 参数数量错误(2 为 1),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21864818/

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