When deploying my application to Heroku, I'm missing my user forum, as created by gem/engine Forem. I've had to do some db resetting both on locally and heroku, but locally I've found that running rails g install:forem restores the forem in my development environment. I've been unsuccessful replicating that success with heroku. I'm looking for either A) specific information about deploying with this gem, or B) general information about how to troubleshoot the issue. I'm happy to post code, but I'm sure sure what's relevant.
Gemfile:
gem 'rails', '4.1.4'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'spring', group: :development
gem 'devise'
gem 'bootstrap-sass', '~> 3.2.0'
gem 'autoprefixer-rails'
gem 'simple_form'
gem 'pg'
gem 'newrelic_rpm'
gem 'forem', github: "radar/forem", branch: "rails4"
gem 'forem-bootstrap', github: "radar/forem-bootstrap"
gem 'forem-theme-base', :github => 'radar/forem-theme-base'
gem 'forem-redcarpet', github: "radar/forem-redcarpet"
gem 'will_paginate', '3.0.5'
gem 'unicorn'
gem 'rails_12factor', group: :production
I was facing the same issue when deploying my Rails 4 application to Heroku.
I am using both Devise for authentication and Forem for generating the forums.
In my dev environment, I installed Devise and Forem based on this tutorial:
http://www.sitepoint.com/forem-rails-forum-engine/
When deploying, as all was already present in the dev environment (i.e. models), the only thing was to install Devise and Forem (with no need for other steps):
heroku run rails generate devise:install
heroku run rails generate forem:install
For each, I replied to overwrite files that could be present, but actually if you configured Devise or Forem, keeping the files (initializers) you just uploaded would be a good idea !
Et voilĂ !
Related
After dealing with a problem where heroku rejected to push because of assets rejection (When deploying heroku app I get push rejected error (Precompiling assets failed)), solution was this command: RAILS_ENV=production bundle exec rake assets:precompile.
Now my app is finally pushed to heroku and there is no longer default message on the app URL, however page is now blank.
This is my Gemfile:
source 'https://rubygems.org'
gem 'rails', '4.2.2'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
# rake
gem 'rake', '11.1.2'
# csv reader
gem 'smarter_csv'
# bower rails
gem 'bower-rails'
# angular templates
gem 'angular-rails-templates'
# angular material
gem 'rails-angular-material'
# jquery ui
gem 'jquery-ui-rails'
# ionicons
gem 'ionicons-rails'
# Get user location info
gem 'geocoder'
group :development, :test do
gem 'byebug'
gem 'sqlite3'
end
gem 'spring'
group :development do
gem 'web-console', '~> 2.0'
end
group :test do
gem 'minitest-reporters', '1.0.5'
gem 'mini_backtrace', '0.1.3'
gem 'guard-minitest', '2.3.1'
end
group :production do
gem 'pg'
gem 'rails_12factor'
end
ruby "2.2.1"
And this is my Bowerfile:
asset 'angular'
asset 'angular-route'
asset 'angular-material'
On the screenshot there are 3 windows, source code from heroku app, heroku app (blank page) and same app on localhost. Whole file structure can be seen here: https://github.com/kunokdev/flightmap because I really don't know which part could cause this problem. How do I fix this to properly show my web page?
There were no errors in console when I was pushing it, however this line caught my eye:
remote: Detected manifest file, assuming assets were compiled locally
The whole console log can be found here: https://jpst.it/GTtq
The problem was actually in Angular code. Ruby on Rails minifies files on production which led to broken code in one of Angular controllers which is answered here: Angular code gets broken after minified and concated by Ruby on Rails
I developed a Book Review app locally, then pushed to bitbucket, and then deployed to Heroku. Everything seemed to go smoothly, but the Heroku version of the app is missing the actual data - like books, categories, users, etc. I did edit the gemfile as was suggested, so I'm wondering what I'm missing. What's necessary to actually import all my tabular data? Here's the gemfile:
source 'https://rubygems.org'
gem 'rails', '4.2.5'
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 'simple_form', '~> 3.2', '>= 3.2.1'
gem 'bootstrap-sass', '~> 3.3', '>= 3.3.6'
gem 'devise', '~> 3.5', '>= 3.5.3'
gem 'paperclip', '~> 4.3', '>= 4.3.2'
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
group :development do
gem 'sqlite3'
end
group :production do
gem 'pg'
gem 'rails_12factor'
end
So after doing a little more research I have learned that this kind of thing is common, and considered normal. Database structure is pushed to Heroku, but not the populating data itself. Other than using something like a seeds file to start with some initial records, it sounds like the actual populating data should be created on the production level.
Production DB
As an update to your answer, you're dealing with different environments (production for Heroku & development on your local system).
With different environments comes different databases (the data will be different), and as such, the reason you don't see any data in your Heroku db is because there is no data.
The two ways to resolve this are either:
Seed your production db
Use the same db in development as in production (not recommended).
The simplest answer to your question is to use the seeding methodology in Rails:
#db/seeds.rb
Model.find_or_create_by attribute: "value"
This can then be invoked by running rake db:seed in your console.
Run db:migrate and then git add -A, commit, etc
So Solidus is a fork of Spree and Spree is no longer maintained.
Am following the instructions on the Solidus's Github page (https://github.com/solidusio/solidus) to install it. And am stuck at this command bundle exec rails g spree:install this command raises the following error:
/Users/user1/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/handlebars_assets-0.19.1/lib/handlebars_assets.rb:20:in 'block in register_extensions': undefined method 'register_engine' for nil:NilClass (NoMethodError)
Not sure if this might help but before trying to install Solidus I was working on a Spree project.
Also, here is my Gemfile:
source 'https://rubygems.org'
# Solidus E-Commerce
gem 'solidus'
gem 'solidus_auth_devise'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.4'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# 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', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
Any help is really appreciated.
Update:
This is a known bug with handlebars-assets gem, which is resolved in master.
Adding the line :
gem 'handlebars_assets', github: 'leshill/handlebars_assets'
to your Gemfile will solve your problem until a new version contains the relevant fix.
Move the lines :
gem 'solidus'
gem 'solidus_auth_devise'
below gem 'rails', '4.2.4' because the former depends on the latter.
We've released a new version of solidus (v1.1.1) which locks sprockets-rails to 2.x to fix this issue.
https://github.com/solidusio/solidus/releases/tag/v1.1.1
In lieu of upgrading you can also specify the older sprockets-rails version in your Gemfile
gem "sprockets-rails", "~> 2.3"
I am trying to follow this Airpair tutorial by Fernando Villalobos, to play around with Rails and React through the react-rails gem.
I created a brand new Rails 4 app and I am now trying to install react-rails.
This is my Gemfile:
source 'https://rubygems.org'
gem 'rails', '4.2.2'
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
gem 'bootstrap-sass'
gem 'react-rails', '~> 1.4.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
gem 'byebug'
gem 'web-console', '~> 2.0'
gem 'spring'
end
I already ran both bundle install and bundle update (just in case).
But, whenever I try to run rails g react:install as recommended here, I keep getting the following error:
Could not find generator 'react:install'. Maybe you meant 'test_unit:job' or 'test_unit:model' or 'generator'
Run `rails generate --help` for more options.
Any idea of what's wrong here?
Try running spring stop. You might have attached to an old process.
I had the same problem. I just tried it again in a new rails project - without running bundle install first - and it worked.
Active admin gem is added to my rails project but every time i tried to install rails g active_admin:install, I am getting error like
git://github.com/activeadmin/activeadmin.git (at master) is not yet
checked out. Run bundle install first.
I definitely ran bundle before running "rails g active_admin:install". After running "bundle show" i am seeing i have " * activeadmin (1.0.0.pre 3f916d6)" added to my project but keep getting this error message.My gem file below
source 'https://rubygems.org'
gem 'rails', '4.1.8'
gem 'sqlite3'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0',
group: :doc
gem 'spring', group: :development
gem 'devise'
gem 'activeadmin', github: 'activeadmin'
I had the same issue. It is something to do with spring as when I removed it from the gemfile and run bundle install again, I was able to run rails g active_admin:install
Instead of removing spring you could also try this tip from the spring github issue:
Try running bundle exec spring binstub --all - it should regenerate your bin/spring file