sequel_rails3 0.0.1 → 0.0.2
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.
- data/VERSION +1 -1
- data/lib/sequel_rails3/configuration.rb +16 -9
- data/lib/sequel_rails3/railtie.rb +1 -1
- data/sequel_rails3.gemspec +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
@@ -12,14 +12,14 @@ module SequelRails3
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def normalize!
|
15
|
+
symbolize_keys!
|
16
|
+
|
15
17
|
each_pair do |k, v|
|
16
|
-
k = k.to_sym
|
17
18
|
case k
|
18
19
|
when :uri
|
19
20
|
self[:url] = delete(:uri)
|
20
21
|
when :adapter
|
21
|
-
|
22
|
-
case v
|
22
|
+
case v.to_sym
|
23
23
|
when :sqlite3
|
24
24
|
self[k] = :sqlite
|
25
25
|
when :postgresql
|
@@ -30,18 +30,25 @@ module SequelRails3
|
|
30
30
|
|
31
31
|
# always use jdbc when running jruby
|
32
32
|
if defined?(JRUBY_VERSION)
|
33
|
-
|
33
|
+
if self[:adapter]
|
34
|
+
case self[:adapter].to_sym
|
35
|
+
when :postgres
|
36
|
+
self[:adapter] = :postgresql
|
37
|
+
end
|
38
|
+
self[:adapter] = "jdbc:#{self[:adapter]}"
|
39
|
+
end
|
34
40
|
end
|
35
|
-
|
41
|
+
|
36
42
|
# some adapters only support an url
|
37
|
-
if self[:adapter] =~
|
38
|
-
port = self[:port] ? ":#{self[:port]}" : ""
|
43
|
+
if self[:adapter] && self[:adapter] =~ /^(jdbc|do):/
|
39
44
|
params = {}
|
40
45
|
each_pair do |k, v|
|
41
|
-
next if [
|
46
|
+
next if [:adapter, :host, :port, :database].include?(k)
|
42
47
|
params[k] = v
|
43
48
|
end
|
44
|
-
|
49
|
+
params_str = params.each_pair{ |k, v| "#{k}=#{v}" }
|
50
|
+
port = self[:port] ? ":#{self[:port]}" : ""
|
51
|
+
self[:url] = "%s://%s%s/%s?%s" % [self[:adapter], self[:host], port, self[:database], params_str]
|
45
52
|
end
|
46
53
|
end
|
47
54
|
end
|
@@ -17,7 +17,7 @@ module SequelRails3
|
|
17
17
|
|
18
18
|
Sequel::Model.plugin :active_model
|
19
19
|
|
20
|
-
self.db = Sequel.connect(config)
|
20
|
+
self.db = config[:url] ? Sequel.connect(config[:url], config) : Sequel.connect(config)
|
21
21
|
end
|
22
22
|
|
23
23
|
initializer 'sequel_rails3.logging', :after => :initialize_logger do |app|
|
data/sequel_rails3.gemspec
CHANGED