$

Поиск по тегу: rails

Gem-ы под разные платформы

if RUBY_PLATFORM =~ /win32/
  # Windows OS
  gem 'therubyracer', :platform => :ruby
  gem 'libv8', '3.11.8.0'
else
  # Other OS
  gem 'therubyracer', '0.12.0', :platform => :ruby
  gem 'libv8', '3.16.14.0'
end

Если в RSpec не рендерится JSON через jBuilder

Добавить в {spec/spec_helper.rb}

RSpec.configure do |config|
  # https://github.com/rails/jbuilder/issues/32
  config.render_views = true
end

Подключение twitter bootstrap в Rails 4

Подключение twitter bootstrap v.2

1. Сначала в Gemfile в блок {group :assets} подключаем {gem «twitter-bootstrap-rails»}

group :assets do
    gem 'uglifier', '>= 1.3.0'
    gem 'sass-rails', '~> 4.0.0'
    gem 'coffee-rails', '~> 4.0.0'
    gem "twitter-bootstrap-rails"
end

2. Далее {bundle install}. Потом {rails generate bootstrap:install static}. Всё.

Если у вас при старте приложения Rails пишет что-то типа FileNotFound twitter-bootstrap-static/bootstrap, то в файл config/application.rb дописываем вниз

if defined?(Bundler)
  # If you precompile assets before deploying to production, use this line
  Bundler.require(*Rails.groups(:assets => %w(development test)))
  # If you want your assets lazily compiled in production, use this line
  # Bundler.require(:default, :assets, Rails.env)
end

Подключение twitter bootstrap v.3

Вместо {gem «twitter-bootstrap-rails»} пишем {gem «anjlab-bootstrap-rails», :require => «bootstrap-rails», :github => «anjlab/bootstrap-rails»}

и в файле bootstrap_and_overrides.css должно быть

/*
  =require twitter/bootstrap
*/