我已经安装了 bootstrap-sass gem,我发现 css 在某些页面上工作而不是在其他页面上工作,我不确定这是为什么。下面我已经包含了它不工作的视图,Gemfile 和样式表.
gemfile:- 源' https://rubygems.org '
gem 'rails', '3.2.13'
gem 'pg', '~> 0.15.1'
gem "bcrypt-ruby", '~> 3.0.1'
gem "paperclip", '~> 3.4.2'
gem "will_paginate", '~> 3.0.4'
gem "friendly_id", '~> 4.0.9'
gem 'stripe'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'bootstrap-sass', '~> 2.3.2'
end
group :test do
gem 'rspec-rails', '2.13.2'
gem 'factory_girl_rails', '~> 4.2.1'
gem 'capybara', '~> 2.1'
gem 'launchy', '~> 2.3'
gem 'guard-rspec', '~> 3.0.1'
gem 'shoulda-matchers', '~> 2.1'
gem 'webmock'
end
group :development do
gem 'annotate', ">=2.5.0"
end
group :test, :development do
gem 'database_cleaner'
gem 'rspec-rails', '2.13.2'
gem 'guard-rspec', '~> 3.0.1'
gem 'rb-fsevent', :require => false if RUBY_PLATFORM =~ /darwin/i
gem 'fuubar', '~> 1.1.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails', '~> 3.0.1'
应用程序.css.scss:-
*= require_self
*= require_tree .
*/
@import "bootstrap";
篮子.html.erb
<p><%= notice %></p>
<p><%= @basket_items.product_totals %><p>
<%= button_to "Purchase products", new_payment_path, :class => "btn" %>
<table class="table table-hover">
<tr>
<th>Picture</th>
<th>Name</th>
<th>Price</th>
<th></th>
</tr>
<tr>
<% @basket_items.each do |item| %>
<td><p>Nothingness</p></td>
<td><p><%= item.product.name %></p></td>
<td><p><%= item.product.price %></p></td>
<td><%= button_to 'Remove', basket_item_path(item.id), :method => 'delete', :confirm => 'Are you sure?', :class => "btn" %></td>
<% end %>
</tr>
</table>
类别显示 show.html.erb
<button type="button" class="close" data-dismiss="alert">×</button>
<p><%= flash[:notice] %></p>
<div class="search">
<%= form_tag(search_path, method: "get", :class => "form-search") do %>
<%= text_field_tag(:query, nil, :class => "input-medium search-query") %>
<%= submit_tag("Search", :class => "btn") %>
<% end %>
</div>
<div class="container-fluid">
<div class="row-fluid">
<% @cp.each do |p| %>
<div class="product">
<div class="product-image">
<%= image_tag p.image %>
</div>
<p><%= p.price %></p>
<p><%= link_to p.name, product_path(p.slug) %></p>
<% end %>
</div>
</div>
</div>
类别.css.scss
.product {
display: inline-block;
}
.product-image {
width: 40px;
height: 50px;
}
.row-fluid {
margin-top: 300px;
}
.search {
margin: 100px 10px 0px 0px;
}