Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/heroku-examples/dbdc-demo
Database.com on Heroku demo app
https://github.com/heroku-examples/dbdc-demo
Last synced: 2 days ago
JSON representation
Database.com on Heroku demo app
- Host: GitHub
- URL: https://github.com/heroku-examples/dbdc-demo
- Owner: heroku-examples
- Created: 2011-09-02T14:46:15.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2011-09-02T14:46:49.000Z (over 13 years ago)
- Last Synced: 2024-04-14T18:35:43.876Z (10 months ago)
- Language: Ruby
- Homepage: http://dbdc-demo.herokuapp.com
- Size: 268 KB
- Stars: 6
- Watchers: 6
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Database.com Demo App
This app shows how to use the databasedotcom and omniauth gems to interact with data stored on Database.com from a heroku app using the Database.com addon.
## Install
#from your app dir
heroku addons:add database-com
heroku config | grep DATABASE_COM_URL
cp keys.rv keys.rb.sample*use value from heroku as your ENV var*
bundle install
bundle exec foreman start## Look, ma. No ActiveRecord!
## (creating models)To create models, login through the Database.com addon page from your heroku account.
- Create a custom object called "Product"
- call the name field "Name"
- give it a price field
- give it a description field
- give it an image\_url fieldOr just delete the ProductController and use your own models!
### Special features
We're using ::const\_missing to allow us to dynamically materialize the Database.com model objects.
## Logging in
OmniAuth is handling the login.
Credentials are stored in the session and a connection is established with Database.com each request.OmniAuth has a bug that causes it to drop the "s" part of https, so we have to override it in the omniauth initializer.
### Change this in config/initializers/omniauth.rb
if Rails.env.production?
OmniAuth.config.full_host = "https://www.example.com"
end