2013-12-17 74 views
4

我想顯示一個模式,其中包括對象的信息。我運行軌道4,和Bootstrap 3.我也跟着上SO爲例,已收到一個錯誤:引導3模式錯誤與Rails 4

Sprockets::FileNotFound in Gifts#index 
couldn't find file 'bootstrap-modal' 

我的Gemfile看起來像這樣:

gem 'rails', '4.0.0' 
gem 'bootstrap-sass', '3.0.2.0' 
gem 'activeresource' 

group :assets do 
    gem 'jquery-ui-rails' 
    gem 'jquery-modal-rails' 
end 

group :development, :test do 
    gem 'sqlite3', '1.3.8' 
    gem 'rspec-rails', '2.13.1' 
end 

group :test do 
    gem 'selenium-webdriver', '2.35.1' 
    gem 'capybara', '2.1.0' 
    gem 'factory_girl_rails', '4.2.1' 
end 

gem 'sass-rails', '4.0.1' 
gem 'uglifier', '2.1.1' 
gem 'coffee-rails', '4.0.1' 
gem 'jquery-rails', '3.0.4' 
gem 'turbolinks', '1.1.1' 
gem 'jbuilder', '1.0.2' 
gem 'devise' 
gem 'activeadmin', github: 'gregbell/active_admin' 
gem 'paperclip' 
gem 'aws-sdk' 
gem 'rmagick', '2.13.2' 
gem 'stripe', :git => 'https://github.com/stripe/stripe-ruby' 


group :doc do 
    gem 'sdoc', '0.3.20', require: false 
end 

group :production do 
    gem 'pg', '0.15.1' 
    gem 'rails_12factor', '0.0.2' 
end 

的application.js

//= require jquery 
//= require jquery_ujs 
//= require bootstrap 
//= require bootstrap-modal 
//= require_tree . 

$(document).ready(function() { 
    $('#modal-window').modal('show'); 
    $('.modal-body').html('<%= escape_javascript(render :partial => "recipient_data", :object => @gift) %>'); 
}); 

Show.html.erb

<div class="modal hide fade" id="modal-window"> 
<div class="modal-header"> 
    <a href="#" class="close">×</a> 
</div> 

<div class="modal-body center"> 
<h2>Hello, World</h2> 
<%= render 'charges/recipient_data' %> 
</div> 

<div class="modal-footer">&nbsp; 
</div> 
</div> 

的鏈接模式我的索引頁

<%= link_to 'Show', gift_path(gift), {:remote => true, 
'data-controls-modal' => "modal-window", 
'data-backdrop' => true, 
'data-keyboard' => true, 
:class => "btn btn-primary ", :id => 'show_gift'} %> 

我應該如何在這種情況下加載自舉模式嗎?

回答

13

bootstrap-sass當前版本採用了略有不同的需要線(帶/,而不是-

//= require bootstrap/modal 

但是,因爲你已經包括//= require bootstrap,沒有必要要求modal單獨存檔。

+0

現在正常工作。謝謝! – Questifer