PROBLEM: When the modal window is initially displayed, the user is asked to select a favorite and enter a comment. If the user enters nothing in and clicks the Choose button, an error message appears, as it should. However, at this point, the user cannot dismiss the modal window by clicking the Close button or the X. The modal window stays regardless.
I think this is because of <div id="modal-form" class="modal" style="display: <%= @visitor.errors.any? ? 'block' : 'none';%>">. At this point the visitor.errors object still evaluates to true and show the div style is set to as a block instead of none.
I think that the div style should be reset to none when the user clicks the x or the close button and the visitor.errors object cleared.