i have User model class created with devise. i have role field(admin=0,user=1)in my model my db myhtml
<%if current_user.active_admin? %>
<%= render 'layouts/admin' %>
<%else%>
<%= render 'layouts/user' %>
<% end %>
#User.rb
def active_admin?
#your logic here
end
i want to login if i am a admin check role is 0 render to layouts/admin else i am a user check role is 1 render to layouts/user. how to write a code in model
Aucun commentaire:
Enregistrer un commentaire