'Hide element based on boolean variable in ruby

I have angularJS for frontend, and ruby on rails for backend. I am searching for a permission in the backend, and if it is false, I want to hide the element in the frontend.

In html.erb file

<% if @has_permission %>
<div>Content</div>
<%end%>

In ruby controller,

before_action :check_permission
def check_permission
  @has_permission=false
end

Just this logic doesn't hide the div. Where am I going wrong?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source