首先,我的gemfile
gem 'mysql2'
gem 'json'
gem 'jquery-rails'
gem 'dynamic_form'
gem 'haml-rails'
gem 'geocoder'
gem 'delayed_job_active_record'
gem 'daemons'
gem 'pry'
gem 'debugger'
gem 'unicorn'
gem 'rest-client'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'anjlab-bootstrap-rails', '>= 2.1', :require => 'bootstrap-rails'
gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
当我的 application.js 中有这个清单时
//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap
//= require_tree .
如果我声明一个具有适当属性的输入,像这样
<input autocomplete="off" data-provide="typeahead" data-source="['Alicante','Albacete']" size="30" type="text">
它像魔术一样工作,但我不能在我自己的 js 中做到这一点
$('#my_input').typeahead()
// => TypeError: Object [object Object] has no method 'typeahead'
但是,如果我从清单中删除引导程序并将其明确包含在我的布局中
= javascript_include_tag "application", "bootstrap.min"
两种方式都有效。
谁能解释我为什么?也许资产管道的丑陋者是命名空间引导函数?怎么修?