Use the Heroku cloud service on Ubuntu to publish a database of rails applications

Source: Internet
Author: User
Tags ruby on rails
The program was originally used by the Sqlite3 database.

Modify the Gemfile file to add PG support for Heroku deployment
Group:p Roduction Do
# Gems specifically for Heroku go
Gem "PG"

Bundle Install

Precompile some files, otherwise there will be an error on the Heroku
Bundle EXEC Rake Assets:precompile

Publish application to GitHub top
$ git Add.
$ git commit-a-M "Done with the demo app"
Done with the Demo app, add Heroku PG database support
$ git push

Publish application to Heroku server
$ Heroku Create
$ git push Heroku Master
$ Heroku Rake db:migrate

$ heroku Rename Berryreloaddemoapp

I can now test my database application on the Heroku cloud server.



Use the Heroku cloud service on Ubuntu to publish rails applications


If you execute a command

$ bundle EXEC Rake Assets:precompile

The error is as follows:
Rake aborted!
Undefined method ' Prerequisites ' for Nil:nilclass
(For the full trace by running task with--trace)

Execute command again

$ bundle EXEC Rake Assets:precompile--trace

The error is as follows:

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 ' <top ( Required) > '

Conclusion is rspec-rails-2.0.1 and rake, rails 3.1.3 incompatible, need to be upgraded

Upgrade Method:

Modify the gemfile of the project to remove the Rspec-rails version number if you set the Rspec-rails version number according to the textbook Ruby on Rails 3 tutorial.

Group:d Evelopment Do
Gem ' Rspec-rails '

Group:test do
Gem ' RSpec '
Gem ' Webrat '

Final Execution command

$ bundle Update Rspec-rails

The results show an upgrade to Rspec-rails 2.8.1

Execution of command again succeeded.

$ bundle EXEC Rake Assets:precompile

And then

$ git Add.

$ git commit-am "done with static pages and precompile for Heroku"

$ git push

$ git push Heroku

$ Heroku Rake db:migrate

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.