activerecord-shipworks 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -6
- data/app/models/shipworks/order_charge.rb +1 -1
- data/app/models/shipworks/shipworks_record.rb +5 -1
- data/lib/shipworks/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e7e874df3cf5ae84ec5850101507851ec010c0fe7a1c8e212845099e8cbaad8
|
4
|
+
data.tar.gz: dc1b3b8154af1efb5f8e92c3e030a107f7fa10282817dd0e609abb3ab66fb617
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90ee44646ed1e8fcbffef7f826f9bdcc63cbec9e65d6db2b4f5c00016350047f7f4575f17f8951c446dcef71dd47c88547c43766dc1b15f1cd201a3ab27a4d72
|
7
|
+
data.tar.gz: 29d7f3db9f76912fcf7f769fc2e7f0c95cdae2942231a6519d3c10a62cd484bfa76257ff3280615d341f4ea0ef86c666d04df676b62b0982131421a200f4cf07
|
data/README.md
CHANGED
@@ -13,12 +13,7 @@ And then execute:
|
|
13
13
|
$ bundle
|
14
14
|
```
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
```ruby
|
19
|
-
# config/initializers/shipworks_db.rb
|
20
|
-
SHIPWORKS_DB = YAML.load(ERB.new(IO.read(File.join(Rails.root, "config", "shipworks_database.yml"))).result)[Rails.env.to_s]
|
21
|
-
```
|
16
|
+
ActiveRecord Shipworks uses the main database connection by default. However, in most of the cases, you want to connect to Shipworks as a second database connection. You could do that by setting `ENV['SHIPWORKS_DATABASE_URL]` by using a configuration file called `config/shipworks_database.yml`.
|
22
17
|
|
23
18
|
## Usage
|
24
19
|
You may query Shipworks data as any other ActiveRecord class:
|
@@ -1,7 +1,11 @@
|
|
1
1
|
module Shipworks
|
2
2
|
class ShipworksRecord < ActiveRecord::Base
|
3
3
|
self.abstract_class = true
|
4
|
-
|
4
|
+
shipworks_db = ENV['SHIPWORKS_DATABASE_URL']
|
5
|
+
if shipworks_db.nil? && File.exist?(File.join(Rails.root, "config", "shipworks_database.yml"))
|
6
|
+
shipworks_db = YAML.load(ERB.new(IO.read(File.join(Rails.root, "config", "shipworks_database.yml"))).result)[Rails.env.to_s]
|
7
|
+
end
|
8
|
+
establish_connection shipworks_db if shipworks_db.present?
|
5
9
|
|
6
10
|
def self.table_name
|
7
11
|
self.name.split('::').last
|
data/lib/shipworks/version.rb
CHANGED