The program initially uses the sqlite3 database. Modify the Gemfile file to add the Support group: productiondo # gemsspecificallyforHerokugoheregem "pg" endbundleinstall to the heroku deployment to pre-compile some files. Otherwise, the bundleexecrakeassets will error on heroku:
The program initially uses the sqlite3 database.
Modify the Gemfile file, and add pg support to heroku deployment
Group: production do
# Gems specifically for Heroku go here
Gem "pg"
End
Bundle install
Pre-compile some files; otherwise, an error occurs on heroku.
Bundle exec rake assets: precompile
Publish the application to Github.
$ Git add.
$ Git commit-a-m "Done with the demo app"
Done with the demo app, add heroku pg database support
$ Git push
Publish the application to the heroku Server
$ Heroku create
$ Git push heroku master
$ Heroku rake db: migrate
$ Heroku rename BerryreloadDemoApp
Now I can test my database application on heroku ECS.
Refer:
Use Heroku cloud service on Ubuntu to publish a Rails Application
If you execute the command
$ Bundle exec rake assets: precompile
The following error is reported:
Rake aborted!
Undefined method 'prerequisites 'for nil: NilClass
(See full trace by running task with -- trace)
Execute the command again
$ Bundle exec rake assets: precompile -- trace
The following error is reported:
Rake aborted!
Undefined method 'prerequisites 'for nil: NilClass
/Usr/local/ruby/lib/ruby/gems/1.9.1/gems/rspec-rails-2.0.1/lib/rspec/rails/tasks/rspec. rake: 3: in' '
The conclusion is that rspec-rails-2.0.1 and rake, Rails 3.1.3 are incompatible and need to be upgraded
Upgrade Method:
Modify the Gemfile of the project and remove the rspec-rails version. If you set the rspec-Rails version based on the Tutorial Ruby on rails 3 Tutorial.
Group: development do
Gem 'rspec-rails'
End
Group: test do
Gem 'rspec'
Gem 'webrat'
End
Finally, execute the command
$ Bundle update rspec-rails
The result shows the upgrade to rspec-rails 2.8.1.
The command is successfully executed again.
$ Bundle exec rake assets: precompile
Then,
$ Git add.
$ Git commit-am "Done with static pages and precompile for heroku"
$ Git push
$ Git push heroku
$ Heroku rake db: migrate