【问题标题】:Rails_admin remove the optional labelsRails_admin 删除可选标签
【发布时间】:2017-05-31 05:28:32
【问题描述】:
【问题讨论】:
标签:
ruby
ruby-on-rails-5
rails-admin
【解决方案1】:
我将尝试使用代码 sn-p 来回答您的两个问题,请阅读
厘米
class YourObject < ApplicationRecord
rails_admin do
edit do
field :user do
help nil # This is the word 'Required' in your screenshot
label 'Person' # for rails admin the label might mean something different than to you in this question
default_value do
bindings[:view]._current_user.id # This is what you want as the default
end
read_only true # You can go as far as not letting the current user to change this field
end
end
end
end
【解决方案2】:
您还可以使用删除“可选”关键字
help false