File tree Expand file tree Collapse file tree 8 files changed +42
-24
lines changed Expand file tree Collapse file tree 8 files changed +42
-24
lines changed Original file line number Diff line number Diff line change 1+ github : [dblock]
Original file line number Diff line number Diff line change 1+ name : test
2+ on : [push, pull_request]
3+ jobs :
4+ test :
5+ runs-on : ubuntu-latest
6+ steps :
7+ - uses : actions/checkout@v3
8+ - uses : harmon758/postgresql-action@v1
9+ with :
10+ postgresql version : ' 17'
11+ postgresql db : acme_test
12+ postgresql user : test
13+ postgresql password : password
14+ - uses : ruby/setup-ruby@v1
15+ with :
16+ ruby-version : ' 3.4'
17+ bundler-cache : true
18+ - env :
19+ RACK_ENV : test
20+ DATABASE_URL : postgres://test:password@localhost/acme_test
21+ run : |
22+ bundle exec rake db:create db:migrate
23+ bundle exec rake
Original file line number Diff line number Diff line change 11# This configuration was generated by
22# `rubocop --auto-gen-config`
3- # on 2025-09-25 14:32:18 UTC using RuboCop version 1.81.0.
3+ # on 2025-09-25 14:53:06 UTC using RuboCop version 1.81.0.
44# The point is for the user to remove these configuration records
55# one by one as the offenses are removed from the code base.
66# Note that changes in the inspected code, or installation of new
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11Grape API with Roar
22===================
33
4- [ ![ Build Status] ( http://img.shields.io/travis/ruby-grape/grape-with-roar.svg?branch=with_activerecord )] ( https://travis-ci.org/ruby-grape/grape-with-roar?branch=with_activerecord )
5- [ ![ Dependency Status] ( https://gemnasium.com/ruby-grape/grape-with-roar.svg?branch=with_activerecord )] ( https://gemnasium.com/ruby-grape/grape-with-roar?branch=with_activerecord )
6- [ ![ Code Climate] ( https://codeclimate.com/github/ruby-grape/grape-with-roar.svg?branch=with_activerecord )] ( https://codeclimate.com/github/ruby-grape/grape-with-roar?branch=with_activerecord )
4+ [ ![ test] ( https://github.com/ruby-grape/grape-with-roar/actions/workflows/test.yml/badge.svg?branch=with-activerecord )] ( https://github.com/ruby-grape/grape-with-roar/actions/workflows/test.yml )
75
86A [ Grape] ( http://github.com/intridea/grape ) API that uses [ Roar] ( https://github.com/apotonick/roar ) and ActiveRecord with a PostgreSQL database.
97
Original file line number Diff line number Diff line change @@ -33,7 +33,8 @@ include ActiveRecord::Tasks
3333db_dir = File . expand_path ( 'db' , __dir__ )
3434
3535DatabaseTasks . env = ENV [ 'RACK_ENV' ] || 'development'
36- DatabaseTasks . database_configuration = YAML . load_file ( './config/database.yml' )
36+ yml = ERB . new ( File . read ( File . expand_path ( 'config/database.yml' , __dir__ ) ) ) . result
37+ DatabaseTasks . database_configuration = YAML . safe_load ( yml , aliases : true ) [ ENV . fetch ( 'RACK_ENV' , nil ) ]
3738DatabaseTasks . db_dir = db_dir
3839DatabaseTasks . migrations_paths = File . join ( db_dir , 'migrate' )
3940
Original file line number Diff line number Diff line change 1- development :
2- database : acme_development
1+ default : &default
32 adapter : postgresql
4- encoding : unicode
53 pool : 10
4+ timeout : 5000
5+ encoding : unicode
6+
7+ development :
8+ << : *default
9+ database : acme_development
610
711test :
12+ << : *default
13+ url : <%= ENV["DATABASE_URL"] %>
814 database : acme_test
9- adapter : postgresql
10- encoding : unicode
11- pool : 10
12-
1315
16+ production :
17+ << : *default
18+ url : <%= ENV["DATABASE_URL"] %>
Original file line number Diff line number Diff line change 22
33require File . expand_path ( 'application' , __dir__ )
44
5- db_config = YAML . load_file ( 'config/database.yml' ) [ ENV . fetch ( 'RACK_ENV' , nil ) ]
5+ yml = ERB . new ( File . read ( File . expand_path ( 'database.yml' , __dir__ ) ) ) . result
6+ db_config = YAML . safe_load ( yml , aliases : true ) [ ENV . fetch ( 'RACK_ENV' , nil ) ]
67ActiveRecord ::Base . establish_connection ( db_config )
You can’t perform that action at this time.
0 commit comments