35 lines
934 B
Markdown
35 lines
934 B
Markdown
|
|
# Ribica front office API
|
||
|
|
|
||
|
|
## Getting started:
|
||
|
|
|
||
|
|
1. install postgresql and libraries (for native 'pg' gem to be able to compile)
|
||
|
|
2. run `bundle install`
|
||
|
|
3. create postgresql user protected with password
|
||
|
|
4. create postgresql database
|
||
|
|
5. copy config.rb.example to config.rb and change the information inside of it
|
||
|
|
6. run `rake db:schema:load`
|
||
|
|
7. run `gem install rerun`
|
||
|
|
|
||
|
|
## Running dev server (with autoreloading)
|
||
|
|
|
||
|
|
1. run `rerun ruby app.rb`
|
||
|
|
|
||
|
|
## Generating migrations
|
||
|
|
|
||
|
|
Sinatra has a different syntax than rails to generate migration:
|
||
|
|
|
||
|
|
`rake db:create_migration NAME=create_categories`
|
||
|
|
|
||
|
|
## Handling shared models
|
||
|
|
|
||
|
|
Some of models will necesarrily be shared between front and back office.
|
||
|
|
Migrations for those models *must be in front office* and
|
||
|
|
back office will just have a model file with custom code if needed.
|
||
|
|
|
||
|
|
When generating active scaffold - migration is generated by default so it
|
||
|
|
needs to be removed before using it.
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|