Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 无法使用:键入的存储中的文本_Ruby On Rails_Ruby_Rubygems - Fatal编程技术网

Ruby on rails 无法使用:键入的存储中的文本

Ruby on rails 无法使用:键入的存储中的文本,ruby-on-rails,ruby,rubygems,Ruby On Rails,Ruby,Rubygems,我试过了 typed_store :meta do |s| s.string :name s.text :instructions end 这给了我一个错误键未找到::text,即使列出了:text [:string,:text,:integer,:float,:time,:datetime,:date,:boolean,:decimal,:any]。每个do | type | 有人知道我做错了什么吗s.string有效,但不能s.text您确定gem允许text作

我试过了

  typed_store :meta do |s|
    s.string :name
    s.text   :instructions
  end
这给了我一个错误
键未找到::text
,即使列出了
:text

[:string,:text,:integer,:float,:time,:datetime,:date,:boolean,:decimal,:any]。每个do | type |


有人知道我做错了什么吗
s.string
有效,但不能
s.text

您确定gem允许
text
作为允许的类型吗

\lib/active\u record/typed\u store/field.rb\L38
类型={
布尔值:::ActiveRecord::类型::布尔值,
整数:::ActiveRecord::类型::整数,
字符串:::ActiveRecord::类型::字符串,
浮点:::ActiveRecord::类型::浮点,
日期:::ActiveRecord::类型::日期,
时间:::ActiveRecord::类型::时间,
datetime:::ActiveRecord::Type::datetime,
十进制:::ActiveRecord::类型::十进制,
任意:::ActiveRecord::类型::值,
}
def查找_类型(类型、选项)
TYPES.fetch(type).new(**选项)
结束

您是否将gem添加到gem文件中?它是spring running吗?是的,它在Gemfile中。正是
s.text
给了我
key not found
s.string:instructions
非常有效您可以检查
s
可用的方法
s.methods.grep(/text/)
如果不存在,则正如@morrisetcl所说。顺便说一句,文本似乎只是字符串的别名,不是吗?您使用的是什么版本的gem?我的Gemfille.lock显示
ActiveRecordTypedStore(1.3.1)
。我不知道如何找出文本是否是字符串的别名…这里似乎是这样,不是吗?哦,也许
text
是不允许的。我想知道“`[:string,:text,:integer,:float,:time,:datetime,:date,:boolean,:decimal,:any]的作用是什么。每个do | type | define|方法(type)do | name,**options |@fields[name]=Field.new(name,type,options)end结束```