grape-activerecord 1.1.0 → 1.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 00c4596408538956fc799ddf52a5fb064845fd03
4
- data.tar.gz: 9da3063fdfaaa9656086a3b2f6689db3cb1ce29d
3
+ metadata.gz: 17f781a322a34e75dbc4b239f9e0da0b1ccd2764
4
+ data.tar.gz: 3a95a2017201685364d5d1bee8da528d469c84e6
5
5
  SHA512:
6
- metadata.gz: 18c76a4f1c0a5a8610b1d4d0032aecdbcbb016da37c5487c657d754c7b8d71cf15359369a544f2f6f968900e1c4719a2c0161689a4ffa0e5101219cc6515defa
7
- data.tar.gz: 2bc91adce6a8182c0687c0f739c1359d46f8edd1dba617ce12b885fd7a2943e20d2b3028a0cd508cb30c20f533028aecb3b88a00294591b7bdbba17cc04b2239
6
+ metadata.gz: 1bb3ec6e7c643cc2ec118e5cb690525020ae8654009457b5d6f31c9bfd8e3de1ca4222820e92587fb409ed5479795e7f6f946aefe70b133c81d88ba0a3af6a92
7
+ data.tar.gz: 5c641bf5f8224c59afc03d5c1b2e1166fa5d12b55515b137382eb368fc2fb49b97388c3c05511aee9ffaaa0866941875b7a84a2c2f22204b5ed75aed73ac9869
@@ -13,14 +13,11 @@ module Grape
13
13
  attr_accessor :seed_file
14
14
  end
15
15
 
16
- # The current Rack environment
17
- RACK_ENV = (ENV['RACK_ENV'] || 'development').to_sym
18
-
19
16
  # Connect to database with a Hash. Example:
20
17
  # {adapter: 'postgresql', host: 'localhost', database: 'db', username: 'user', password: 'pass', encoding: 'utf8', pool: 10, timeout: 5000}
21
18
  def self.database=(spec)
22
- ::ActiveRecord::Base.configurations = {RACK_ENV => spec}.stringify_keys
23
- ::ActiveRecord::Base.establish_connection(RACK_ENV)
19
+ ::ActiveRecord::Base.configurations = {rack_env => spec}.stringify_keys
20
+ ::ActiveRecord::Base.establish_connection(rack_env)
24
21
  end
25
22
 
26
23
  # Connect to database with a DB URL. Example: "postgres://user:pass@localhost/db"
@@ -32,7 +29,12 @@ module Grape
32
29
  def self.database_file=(path)
33
30
  raise "#{path} does not exist!" unless File.file? path
34
31
  ::ActiveRecord::Base.configurations = YAML.load(ERB.new(File.read(path)).result) || {}
35
- ::ActiveRecord::Base.establish_connection(RACK_ENV)
32
+ ::ActiveRecord::Base.establish_connection(rack_env)
33
+ end
34
+
35
+ # The current Rack environment
36
+ def self.rack_env
37
+ (ENV['RACK_ENV'] || 'development').to_sym
36
38
  end
37
39
  end
38
40
  end
@@ -1,4 +1,4 @@
1
- require 'grape/activerecord'
1
+ require 'grape/activerecord/activerecord'
2
2
  load "active_record/railties/databases.rake"
3
3
  require "grape/activerecord/rake/activerecord_#{ActiveRecord::VERSION::MAJOR}"
4
4
  load "grape/activerecord/tasks.rake"
@@ -4,7 +4,7 @@ Rake::Task.define_task('db:_load_config') do
4
4
 
5
5
  ActiveRecord::Tasks::DatabaseTasks.tap do |config|
6
6
  config.root = Rake.application.original_dir
7
- config.env = Grape::ActiveRecord::RACK_ENV.to_s
7
+ config.env = Grape::ActiveRecord.rack_env.to_s
8
8
  config.db_dir = Grape::ActiveRecord.db_dir
9
9
  config.migrations_paths = Array(Grape::ActiveRecord.migrations_paths)
10
10
  config.fixtures_path = Grape::ActiveRecord.fixtures_path
@@ -1,6 +1,6 @@
1
1
  module Grape
2
2
  module ActiveRecord
3
3
  # Gem version
4
- VERSION = '1.1.0'
4
+ VERSION = '1.1.1'
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-activerecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Hollinger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-16 00:00:00.000000000 Z
11
+ date: 2015-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grape