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

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -