diff options
author | John Ankarström <john@ankarstrom.se> | 2021-03-02 01:38:19 +0100 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-03-02 01:38:19 +0100 |
commit | c8e09cc8ec756014268405470fdc45db6e0acb95 (patch) | |
tree | cc9d141f342a4123c78643544a08d60ee5ec73cb /interfaces/ruby | |
parent | 8d21b802c35d5b1f8e6e868aaa20c1c0066275c9 (diff) | |
download | comb-c8e09cc8ec756014268405470fdc45db6e0acb95.tar.gz |
Require ruby models and http sub-interfaces dynamically
This makes it easier to add/remove models/sub-interfaces. At the
same time, it is very clear what is happening.
Diffstat (limited to 'interfaces/ruby')
-rw-r--r-- | interfaces/ruby/ruby.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/interfaces/ruby/ruby.rb b/interfaces/ruby/ruby.rb index 4c18111..ffd6d6a 100644 --- a/interfaces/ruby/ruby.rb +++ b/interfaces/ruby/ruby.rb @@ -2,10 +2,9 @@ require 'active_record' ActiveRecord::Base.establish_connection( adapter: 'sqlite3', - database: 'db.sqlite3' + database: "#{__dir__}/../../db.sqlite3" ) -require_relative 'models/config' -require_relative 'models/comment' -require_relative 'models/post' -require_relative 'models/tag' +Dir.glob('models/*.rb', base: __dir__).each do |f| + require_relative f +end |