Rails App: Precompiling assets failed - ruby-on-rails

I'm trying to push my rails app to Heroku, but I got this error:
"couldn't find file 'turbolinks' - however 'turbolinks" is in my gemfile (attached).
source 'https://rubygems.org'
gem 'rails', '4.0.0'
gem 'jquery-rails'
group :production do
gem 'pg'
end
group :development, :test do
gem 'sqlite3'
end
group :assets do
gem 'sass-rails', '~> 4.0.0'
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

Rails 4 doesn't use the :assets group anymore. See http://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-3-2-to-rails-4-0 and discussion from SO here: Why did Rails4 drop support for "assets" group in the Gemfile.

Related

rails _4.2.11.1_ new does not load 'sqlite3'

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.

Pushing to Heroku fails (Devise)

So I'm having issues pushing to Heroku I run
git push heroku master
It starts pushing, then fails with this error
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
NameError: uninitialized constant Devise
/tmp/build_e47e5acc3405b13038fee9893d25b35a/config/initializers/devise.rb:3:in `<top (required)>'
Here's my gemfile
gem 'rails', '4.2.4'
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
gem 'spring', group: :development
gem 'byebug', group: :development
gem 'web-console', '~> 2.0', group: :development
gem 'bootstrap-sass', '~> 3.3.5.1'
gem 'devise', '~> 3.5.2'
gem 'paperclip', '~> 4.3.1'
gem 'aws-sdk', '< 2.0'
gem 'jquery-turbolinks'
gem 'masonry-rails', '~> 0.2.4'
gem 'will_paginate', '~> 3.0.7'
gem 'will_paginate-bootstrap', '~> 1.0.1'
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg', '0.17.1'
gem 'rails_12factor', '0.0.2'
end
It appears Devise is the culprit, would I have to add Devise to " group :production do"? I haven't assigned it to any particular group, but it is in the Gemfile.
Thanks guys.
Edit: I've added "Devise" to :production do, and still the same result.

What should my gemfile look like (Heroku)

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.

Rails Glyphicons are not showing up (BS 2.3.0)

I am having a very hard time displaying any Glyphicons in my Rails app. I can't display any of the BS 2.3 doc icon sets anywhere in my app. I actually downloaded a gem with some icons and those work great but I want to use the BS ones. What are some possible reaosns for this? This is my gemfile:
source 'https://rubygems.org'
ruby '2.0.0'
gem 'rails', '4.0.0'
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'bootstrap-sass', '~> 2.3.2.0'
gem 'bcrypt-ruby', '= 3.0.1'
gem 'twilio-ruby'
gem 'will_paginate'
gem 'bootstrap-will_paginate'
gem 'font-icons-rails', :git=> 'git://github.com/shorelabs/font-icons-rails.git'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
group :doc do
gem 'sdoc', require: false
end
group :development do
gem 'quiet_assets'
gem 'pry'
gem 'sqlite3'
end
group :production do
gem 'pg'
gem 'rails_12factor'
end
For example, this line of code wont produce any icons in my Nav partial:
<li>
<%= link_to(new_category_path) do %>
<i class="icon-plus"></i>
New Category
<% end %>
</li>

Gemfile syntax error: when trying bundle install

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).

Resources