redmine问题集锦

当我新建LDAP认证模式时,遇到如下错误:

timeout是auth_source的一个属性,但是却没有生成timeout的读方法,经过跟踪发现是因为添加了 safe_attributes 中的 bad_attribute_names 方法返回的数组包含了timeout关键字,导致该方法没有生成。

解决方法:从Gemfile中去掉safe_attributes,然后 bundle install 解决。

关键句子:ActionView::Template::Error (private method `timeout' called for #<AuthSourceLdap:0x007fcfc0fb8d70>

 

删除了上面的safe_attributes后,redmine新建问题又有一个错误:

这是由于issue_relations表的有一个列名叫做delay,而刚好AR中定义了这个方法,因此在生成实例方法时抛出了这个异常。解决办法就是不自动生成delay的实例方法,如下:

def _delay
  read_attribute(:delay)
end
def _delay=(value)
  write_attribute(:delay, value)
end
# 因为delay也是AR的一个方法,所以会导致报错,这个方法可以保证不生成delay的实例方法,完全由类自己实现
def self.instance_method_already_implemented?(method_name)
  return true if method_name == "delay"
  super
end

关键句子:ActiveRecord::DangerousAttributeError (delay is defined by Active Record. Check to make sure that you don't have an attribute or method with the same name.)

 

转载于:https://www.cnblogs.com/zhangyanpei/p/5358167.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值