我正在尝试使用邮箱实现选择的 gem 来接收新消息。但选择框总是显示为空。
消息/new.html.erb
<%= form_tag({controller: "messages", action: "create",
:class => "form-horizontal"}, method: :post) do %>
<h3>Reply</h3>
<%= select :recipients,
User.all.map { |u| [u.name, u.id] },
{ class: 'chosen-select' }
%>
<%= text_area_tag :body,nil, class: 'form-control'%>
<%= submit_tag 'Send message', class: "btn btn-primary" %>
<% end %>
Messages.js.coffee
$('#messages_recipients').chosen()
js错误:
[Error] ReferenceError: Can't find variable: jQuery (chosen.jquery.js, line 524)
[Error] ReferenceError: Can't find variable: $ (messages.js, line 2)
任何人都可以看到问题吗?我猜我只是错过了一些小东西,它已经烦了很长时间了;/