Alex Ermolaev Alex Ermolaev - 3 months ago 9
CSS Question

Bootstrap doesn't work in my Rails app with mongodb

I have a simple Rails app with mongodb as my database.
I just want to add bootstrap to it and previously I didn't have any problems with this, but this time I have.

Gemfile

source 'https://rubygems.org'
gem 'rails', '4.2.6'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
gem 'bootstrap-sass'
gem 'sprockets-rails'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'mongoid'


So, I've added bootstrap-sass

Here I include it in my application.js

//= require jquery
//= require bootstrap-sprockets
//= require jquery_ujs
//= require turbolinks
//= require_tree .


And here in application.scss

/*
*= require_self
*= require_tree .
*/
@import "bootstrap-sprockets";
@import "bootstrap";


development.rb

Mongoid.load!("config/mongoid.yml", :development)


mongoid.yml

development:
clients:
default:
database: app
hosts:
- localhost:27017
options:

options:
test:
clients:
default:
database: app_test
hosts:
- localhost:27017
options:
read:
mode: :primary
max_pool_size: 1


It doesn't work. Moreover, when a try to write something like

<body>
<h1>test</h1>
<%= yield %>
</body>


in my application.html.erb doesn't display on the page.

Answer

The problem was that in my controller I wrote

class BotsController < ActionController::Base

Now changed to

class BotsController < ApplicationController

and it works.

Comments