Skip to content

Implementation Details and Implementation Workflow

Eugen Kuksa edited this page Aug 29, 2016 · 5 revisions

Ontohub-Backend

Models

Implementation

All models are defined in the ontohub-models gem. These are included in the ontohub-backend and hets-ontohub-adapter. However, they must not be required in the respective Gemfile, that is, use this line:

gem 'ontohub-models', github: 'ontohub/ontohub-models', branch: 'master', require: false

Instead, a database connection must be established first and then they must be required manually. This is due to a limitation of the design of Sequel::Model: Before loading a model class, a database connection must exist.

Workflow

If you want to use a generator for a model or a migration, you must use it in the ontohub-backend repository because it is only available in a Rails environment:

rails generate model <model-name> [attribute:type...]
# or
rails generate migration <migration-name>

This generates model and/or migration files in the default directories of Rails. These files must then be moved to the ontohub-models repository and be committed there.

Clone this wiki locally