Add ' Bootstrap-sass ' to the Gemfile file and run the bundle install
' Bootstrap-sass '
Add a line of code to the CONFIG/APPLICATION.RB to make Bootstrap-sass and asset pipeline compatible
classApplication <rails::application#Settings in config/environments/* take precedence over those specified here. #application configuration should go to files in Config/initializers #--All. rb files in that directory is automatically loaded. #Set time.zone default to the specified zone and make Active Record Auto-convert to this zone. #Run "rake-d time" for a list of the tasks for finding time zone names. Default is UTC. #Config.time_zone = ' Central Time ' (US & Canada) ' #The default locale is:en and all translations from CONFIG/LOCALES/*.RB,YML is auto loaded. #Config.i18n.load_path + = Dir[rails.root.join (' My ', ' locales ', ' *.{ RB,YML} '). to_s] #Config.i18n.default_locale =:d e #Do not swallow errors in after_commit/after_rollback callbacks.Config.active_record.raise_in_transactional_callbacks =true#make Bootstrap-sass and asset pipeline compatible Config.assets.precompile + =%w (*.png *.jpg *.jpeg * . gif) end
To use bootstrap you also need to create a CSS file in the App/assets/stylesheets directory: custom.css.scss
The contents are:
@import "Bootstrap-sprockets" @import "Bootstrap"
Also add a line to the App/assets/javascripts/application.js file
= Require bootstrap
This enables the use of bootstrap JavaScript components.
Now it's time to start using bootstrap.
Rails uses bootstrap