I am new to both Ruby and Ruby on Rails. To begin familiarizing myself with the framework, I am going through One Month Rails. Unfortunately, I have hit a snag. Up until last night, I was able to push my app changes to Heroku. Now, however, whenever I try to push changes through, I get this error.
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
couldn't find file 'bootstrap'
This is after bundle install(ing) -> git add . -> git commit -> git push. I have done quite a bit of googling, but just can't seem to figure it out. Any help is much appreciated! Thanks!
I am attaching my Gemfile.
Source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
gem 'jquery-rails'
gem 'devise'
gem 'simple_form'
gem 'protected_attributes'
# Use sqlite3 as the database for Active Record
group :production do
gem 'pg'
gem 'rails_12factor'
end
group :development, :test do
gem 'sqlite3'
gem 'sass-rails', '~> 4.0.0'
gem 'bootstrap-sass', '~> 2.3.2.1'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
end
group :doc do
gem 'sdoc', require: false
end
Move out following gems from group :development, :test
gem 'sass-rails', '~> 4.0.0'
gem 'bootstrap-sass', '~> 2.3.2.1'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
Heroku tries to compile files for production, not for development and testing.
Related
I'm new to rails and was trying with rvm
rvm use 2.4.1
rails _4.2.11.1_ new hello_app
cd hello_app
rails s
which works with Rails 5 but fails with rails 4 and ruby 2.4.1 on my Mac
Gem::LoadError (Specified 'sqlite3' for database adapter, but the gem is not loaded. Add `gem 'sqlite3'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).):
activerecord (4.2.11.1) lib/active_record/connection_adapters/connection_specification.rb:177:in `rescue in spec'
My Gemfile which is what rails new generated without comments
source 'https://rubygems.org'
gem 'rails', '4.2.11.1'
gem 'sqlite3'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
runtimes
gem 'jquery-rails'
more: https://github.com/rails/turbolinks
gem 'turbolinks'
https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
group :development, :test do
gem 'byebug'
end
group :development do
gem 'web-console', '~> 2.0'
gem 'spring'
end
It is just because rails can't find exact version of gem needed, please provide version explicitly as below,
gem 'sqlite3', '~> 1.3.6'
You can find reference here
If it does not work, vary version and try as gem 'sqlite3', '~> 1.3.0' in gemfile.
I have trouble setting up my gems correctly while working with Heroku. Can someone tell me what it should look like? Here's what it looks like currently:
source 'https://rubygems.org'
gem 'sinatra', '1.0'
gem 'rails', '4.2.6'
gem 'sqlite3'
gem 'sass-rails', '~> 5.0'
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
group :development, :test do
gem 'byebug'
end
group :development do
gem 'web-console', '~> 2.0'
gem 'spring'
end
Help is much appreciated, thanks.
Heroku doesn't support running rails apps using sqlite3 so you should remove that and use pg instead.
Or you could set that for your development env only and set pg for production.
But it's always recommended to run your local env as similar as possible to your production, so that you won't get any surprises when you go live.
source 'https://rubygems.org'
gem 'rails', '4.0.0'
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
gem 'bootstrap-sass', '~> 3.0.3.0'
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
gem 'rails_12factor'
end
group :doc do
gem 'sdoc', require: false
end
// When I try to bundle install --without production I get an error message.
This line looks a bit wrong gem 'bootstrap-sass', '~> 3.0.3.0'
Usually you would expect the semantic versioning to go to three levels only
I suspect the problem isn't being picked up when bundling locally.
The bundle install command installs the gems based on the Gemfile.lock file in your project. Try running a bundle update instead - this may resolve any version conflicts you may be having in your Gemfile (depending on if you've made any updates).
I keep getting a
Specified 'sqlite3' for database adapter, but the gem is not loaded. Add `gem 'sqlite3'` to your Gemfile.
Here's my Gemfile:
source 'https://rubygems.org'
ruby '2.0.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
gem 'thin'
# gem 'sqlite3'
gem 'mongoid', git: 'https://github.com/mongoid/mongoid.git'
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
group :doc do
gem 'sdoc', require: false
end
Where else do you specify an adapter? As you can see sqlite3 is excluded from the gemfile. Server restart didn't seem to do the trick.
Please check your database.yml file . you might have specified the adapter as sqlite.
I got this error if I try to push to Heroku. On production it all works fine.
If I run "rake assets:precompile" on development It works fine. When Heroku does it, it fail
Heroku Logs
/app/vendor/bundle/ruby/2.0.0/bundler/gems/active_admind9c593b13a6f/lib/active_admin/application.rb:258:in `generate_stylesheets': uninitialized constant Sass::Plugin
source 'https://rubygems.org'
ruby '2.0.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
# Use postgresql as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# Use jquery as the JavaScript library
gem 'jquery-rails', '~> 2.3.0'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.0.1'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
gem 'protected_attributes'
gem 'devise', github: 'plataformatec/devise', branch: 'rails4'
gem 'responders' , github: 'plataformatec/responders'
gem 'inherited_resources', github: 'josevalim/inherited_resources'
gem 'ransack', github: 'ernie/ransack', branch: 'rails-4'
gem 'activeadmin', github: 'akashkamboj/active_admin', branch: 'rails4'
gem "cancan"
gem 'omniauth'
gem 'omniauth-facebook'
gem 'carrierwave'
gem 'activeadmin', github: 'gregbell/active_admin', branch: 'rails4'