rails admin - Conditional read only on a field -
it seems should possible pass in conditional in place of true/false "read_only" expecting field, doesn't seem work. there way conditional read_only on field based on field's value?
things i've tried don't seem work:
- read_only true if self.blah runs doesn't conditionally make read_only
- read_only true if bindings[:object].fieldname.blah gives error nomethoderror: undefined method []' nil:nilclass @ server start
- read_only true if value.blah gives error nomethoderror: undefined method[]' nil:nilclass @ server start
- read_only , passing in lambda instead of true/false
pass block:
field :user, :belongs_to_association "required. can't changed after creation." read_only bindings[:object].user_id.present? end end
Comments
Post a Comment