Reputation: 371
I am using bootstrap2 and set up tabs
<ul class= "nav nav-tabs">
<li class="active"><a href="#menu1" data-toggle="tab">疑問リスト</a></li>
<li class=""><a href="#menu2" data-toggle="tab">フォロー中の投稿</a></li>
<li class=""><a href="#menu3" data-toggle="tab">ユーザーの投稿</a></li>
</ul>
on show.html.erb(members). It works on the local but doesn't work on the remote(heroku).
And I checked logs,doing heroku logs and got some error messages. I have no idea how to solve this.Could you help me?
☆error messages
ActionController::RoutingError (No route matches [GET] "/members/js/bootstrap.min.js"):
ActionController::RoutingError (No route matches [GET] "/members/js/bootstrap.min.js"):
☆show.html.erb(members_controller)
<script src="http://code.jquery.com/jquery-1.8.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
ActionController::RoutingError (No route matches [GET] "/members/css/bootstrap.min.css"):
Upvotes: 6
Views: 11578
Reputation: 1
If you installed according to instructions: https://github.com/twbs/bootstrap-sass#a-ruby-on-rails and use default template: http://getbootstrap.com/getting-started/#template then you just need to remove the following lines from template:
<link href="css/bootstrap.min.css" rel="stylesheet">
<script src="js/bootstrap.min.js"></script>
Upvotes: 0
Reputation: 5611
Change the Javascript file import to this:
<script src="/assets/bootstrap.min.js"></script>
and the CSS link to this:
<link href="/assets/bootstrap.min.css" media="all" rel="stylesheet" />
In Rails 3.x and 4.x all the assets must be placed in the app/assets
directory. Javascript files will go into the javascripts
folder, CSS file into the stylesheets
folder and the images into the images
folder. You can also add more folder to differentiate other asset types.
When in production, all assets will be available under the global folder /assets
with no asset type distinction.
If you have correctly placed the assets, the best way to load them into your pages is using the absolute reference to them. Eg.
<%= stylesheet_link_tag "/assets/bootstrap.min" %>
<%= javascript_include_tag "/assets/bootstrap.min" %>
Upvotes: 8