Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ruby-on-rails-3/4.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.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 未定义的方法`加密的纬度';对于#<;位置:0x007f574a4eef50>;_Ruby On Rails_Ruby On Rails 3_Ruby On Rails 4_Encryption Symmetric_Attr Accessible - Fatal编程技术网

Ruby on rails 未定义的方法`加密的纬度';对于#<;位置:0x007f574a4eef50>;

Ruby on rails 未定义的方法`加密的纬度';对于#<;位置:0x007f574a4eef50>;,ruby-on-rails,ruby-on-rails-3,ruby-on-rails-4,encryption-symmetric,attr-accessible,Ruby On Rails,Ruby On Rails 3,Ruby On Rails 4,Encryption Symmetric,Attr Accessible,嗨,我正在使用对称加密gem加密一些字段。我已经生成了所有的键,并遵循其中给出的所有步骤。但当我试图在服务器上保存数据时,它会在这些行上抛出错误 attr_encrypted :latitude attr_encrypted :longitude 错误是 undefined method `encrypted_latitude' for #<Location:0x007f574a4eef50> 未定义的方法“加密的纬度”# 我已经检查了gem的类型、步骤,所有这些看起来都很

嗨,我正在使用对称加密gem加密一些字段。我已经生成了所有的键,并遵循其中给出的所有步骤。但当我试图在服务器上保存数据时,它会在这些行上抛出错误

 attr_encrypted :latitude
 attr_encrypted :longitude
错误是

undefined method `encrypted_latitude' for #<Location:0x007f574a4eef50>
未定义的方法“加密的纬度”#
我已经检查了gem的类型、步骤,所有这些看起来都很好。 知道我遗漏了什么吗?当我从模型中删除这些线时,所有这些都起作用了。此外,我还为字段和受保护的属性gem添加了attr_accessible,以使attr_可访问


你知道我哪里出错了吗?谢谢,看来你可能一个位置都没有。在查询的末尾是否有第一个

i、 e


该错误意味着名为
加密_latitude
的列在
位置
表中不可用

从:

class用户
您的表中的列名是
加密的_lation
吗?您听说过吗。不,我没有……但在这种情况下,这是否意味着我需要在表中添加加密的_lation字段……这没有意义,因为我想加密这些字段,而不是在同一个表中的不同字段中保持正常和加密字段到U纬度。正常值将不会被存储。啊……好的,谢谢……我尝试了一下并接受了答案……:)
lat = Latitude.where( query ).first
class User < ActiveRecord::Base
  # Requires table users to have a column called encrypted_bank_account_number
  attr_encrypted :bank_account_number