text_field disabled in Ruby on Rails -
i have following code disable text_field
when user not admin , working fine:
<div class="form-group"> <%= f.label :nome, "genero" %> <%= f.text_field :nome, class: "form-control", disabled: true if not is_admin? %> </div>
but when user admin text_field
disappears. know why happening , have do?
assuming is_admin?
returns true
or false
, can do
<%= f.text_field :nome, class: "form-control", disabled: !is_admin? %>
currently, if condition i.e., if not is_admin?
applied on entire text field, results in text field disappearance when is_admin?
returns true
, when condition returns false
text field displayed.
Comments
Post a Comment