Reputation: 20746
I'm trying to generate a bootstrap-themed scaffold via the following actions:
Add gem 'twitter-bootstrap-rails'
line to the end of the Gemfile
and run bundle install
Run rails generate bootstrap:install static
as stated in the documentation
Place the DB account details (username and password) to the "default" section of database.yml
file and run rake db:create
Run rails g scaffold Purchase company_name:text product_name:text contact_person:text email:text comment:text
Run rake db:migrate
Run rails g bootstrap:themed Purchases
Every command returns 0, so I restarted a web-server and go to the 127.0.0.1:3000/purchases
, but it looks like it doesn't use twitter bootstrap at all:
purchases/index.html.erb
<h1>Listing purchases</h1>
<table>
<thead>
<tr>
<th>Company name</th>
<th>Product name</th>
<th>Contact person</th>
<th>Email</th>
<th>Comment</th>
<th colspan="3"></th>
</tr>
</thead>
<tbody>
<% @purchases.each do |purchase| %>
<tr>
<td><%= purchase.company_name %></td>
<td><%= purchase.product_name %></td>
<td><%= purchase.contact_person %></td>
<td><%= purchase.email %></td>
<td><%= purchase.comment %></td>
<td><%= link_to 'Show', purchase %></td>
<td><%= link_to 'Edit', edit_purchase_path(purchase) %></td>
<td><%= link_to 'Destroy', purchase, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
<br>
<%= link_to 'New Purchase', new_purchase_path %>
Why? What am I doing wrong? How can I fix it?
I'm using Ruby on Rails 4.1.4 btw.
Upvotes: 4
Views: 833
Reputation: 11728
Try these:
Make sure the <table>
tag has the class(es) required by Bootstrap. For example: <table class="table table-striped">
.
Also, the scaffold-generated styles in app/assets/stylesheets/scaffolds.scss
might be interfering. Remove them and see what happens.
And as @anusha said in a comment, remember to use the singular form when you run the generator. For example: rails g bootstrap:themed Purchase
, not Purchases
.
Upvotes: 1