I am trying to trigger a bootstrap modal based on conditions about the current user. Essentially, to do anything in the page the user is accessing, they need to have created a hotel in the system. If they haven't, I want a modal to pop up with the creation form. Currently, I have:
<%= unless current_user.hotels.exists?
"<script>
$('#createhotelModal').modal('toggle')
</script>"
end
%>
Which simply inserts the as text. Trying to next a <%= javascript_tag do %> command doesn't work with the controller throwing various errors. Is this the smart way to do it, or should I just create a completely separate page and use the controller to send people to the correct page?