【问题标题】:password value does not appear inside textbox on edit编辑时密码值不会出现在文本框中
【发布时间】:2013-03-25 10:26:05
【问题描述】:

我有一个非用户模型,它有 attrs/db-columns,作为“密码”,还有一个“其他密码”,当编辑该对象时,它们的值不会出现在文本框中

我在 activeadmin-0.5.1 中没有发现任何会导致这种情况的可疑代码。

有什么提示吗?

即使我使用默认值或输入以下内容,我也会得到相同的结果

form do |f|
  f.inputs "Details" do
    f.input :user, :as => :select
    f.input :type, :input_html => { :disabled => 'disabled' }
    f.input :password
    f.input :extra
    f.input :other_password
  end
  f.actions

结束

似乎对正在编辑的任何名称中包含“密码”的字段进行过滤?

【问题讨论】:

    标签: ruby-on-rails-3 activeadmin


    【解决方案1】:

    这很可能是由于formtastic's inferred field types,将任何匹配“密码”的字段变为:password 类型。尝试使用 :as => :string 选项设置这些输入:

    form do |f|
      f.inputs "Details" do
        f.input :user, :as => :select
        f.input :type, :input_html => { :disabled => 'disabled' }
        f.input :password, :as => :string
        f.input :extra
        f.input :other_password, :as => :string
      end
      f.actions
    end
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-09-09
      • 1970-01-01
      • 1970-01-01
      • 2014-03-20
      • 2016-11-16
      • 2020-02-17
      • 2019-03-21
      相关资源
      最近更新 更多