I'm trying to figure out the best way to hide certain fields in user profile based on user's preference. So far I'm using a boolean field and an if, then statement.
<% if @user.show_email == 'true' -%>
<%=h @user.email %>
<% else -%>
hidden
<% end -%>
I was wondering if I could use declarative_authorization or some other better method that is more DRY. I prefer to have in a way like if @user.role == "admin" show all, if @user.role == "regular" show only non-hidden fields. etc
Thanks