Show or hide fields depending on the Acl9 role - Ruby on Rails
Posted
by Michaël
on Stack Overflow
See other posts from Stack Overflow
or by Michaël
Published on 2010-05-31T13:27:16Z
Indexed on
2010/05/31
13:33 UTC
Read the original article
Hit count: 184
ruby-on-rails
|acl9
Hi,
I am using Acl9 to manage the roles and I want to hide the checkbox usertype if the user has the role :customer and show it if the role is :manager. I want that just the :manager can edit all the fields and some for the :customer.
Thank you for your help!
<h1>Editing user</h1>
<% form_for(@user) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :usertype %><br />
<%= f.check_box :usertype %>
</p>
<p>
<%= f.label :surname %><br />
<%= f.text_field :surname %>
</p>
<p>
<%= f.label :firstname %><br />
<%= f.text_field :firstname %>
</p>
<p>
<%= f.label :phone %><br />
<%= f.text_field :phone %>
</p>
<p>
<%= f.label :email %><br />
<%= f.text_field :email %>
</p>
<p>
<%= f.label :registrationdate %><br />
<%= f.datetime_select :registrationdate %>
</p>
<p>
<%= f.label :login %><br />
<%= f.text_field :login %>
</p>
<p>
<%= f.label :password %><br />
<%= f.text_field :password %>
</p>
<p>
<%= f.submit 'Update' %>
</p>
<% end %>
<%= link_to 'Show', @user %> |
<%= link_to 'Back', users_path %>
© Stack Overflow or respective owner