Skip to content

davenguyen/nfl_pool

Repository files navigation

roda-sequel-stack

This is an application skeleton for an app using Roda as the web framework, and Sequel as the database library. It’s set up so you can clone this repository and base your application on it:

git clone https://github.com/jeremyevans/roda-sequel-stack.git
mv roda-sequel-stack my_app
cd my_app
rake setup[MyApp]

Database Setup

The default DATABASE_URL uses a PostgreSQL database, with an application specific PostgreSQL database account. You can create this via:

createuser -U postgres my_app
createdb -U postgres -O my_app my_app_production
createdb -U postgres -O my_app my_app_test
createdb -U postgres -O my_app my_app_development

Using an application specific, regular database user account (not a database superuser account), is recommended for security reasons.

Next Steps

First, you’ll want to edit the default migration file (migrate/001_tables.rb) to define the database schema for your application. After modifying the migration file, and optionally adding additional migration files, you can run the migrations:

rake dev_up  # Migrate the development database up
rake test_up # Migrate the test database up
rake prod_up # Migrate the production database up

After editing the default migration file, you’ll probably want to rename and edit the default model file (models/model1.rb), as well as add other model files as appropriate. After the models have been set up, you can get an irb shell with your models loaded:

rake dev_irb  # IRB shell with models connected to the development database
rake test_irb # IRB shell with models connected to the test database
rake prod_irb # IRB shell with models connected to the production database

After editing the model files, you’ll probably want to edit the application file (app.rb). You’ll also want to rename and edit the default routing subtree (routes/prefix1.rb). After that, you’ll probably want to edit the layout (views/layout.erb) and index page (views/index.erb), as well as add any other views.

After making those changes, you can start your application using rackup or similar program.

Libraries Used

roda

web framework

sequel

database library

rack-unreloader

development code reloader

minitest

testing framework

minitest-hooks

around/around(:all) hooks for minitest

capybara

web application testing helpers

Environment Variables Used

DATABASE_URL

database connection URL to give to Sequel, default is to create one based on the application’s name and RACK_ENV.

RACK_ENV

environment to use (production, development, or test), defaults to development.

Author

Jeremy Evans <code@jeremyevans.net>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •