override_active_record_dynamic_finders 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.
@@ -8,7 +8,7 @@ module OverrideActiveRecordDynamicFinders
|
|
8
8
|
if args.first.is_a?(Symbol) && args.last.is_a?(Hash)
|
9
9
|
compute_result(*args).send(args.first)
|
10
10
|
elsif args.first.is_a?(Symbol) && !args.last.is_a?(Hash)
|
11
|
-
result =
|
11
|
+
result = self
|
12
12
|
result.send(args.first)
|
13
13
|
else
|
14
14
|
super *args
|
@@ -31,7 +31,7 @@ module OverrideActiveRecordDynamicFinders
|
|
31
31
|
private
|
32
32
|
|
33
33
|
def compute_result(*args)
|
34
|
-
result =
|
34
|
+
result = self
|
35
35
|
|
36
36
|
finder_keys = KEYS_SET & args.last.keys
|
37
37
|
finder_hash = args.last
|
@@ -70,14 +70,15 @@ module OverrideActiveRecordDynamicFinders
|
|
70
70
|
|
71
71
|
conditions = nil
|
72
72
|
|
73
|
-
if finder_hash[:conditions].blank?
|
73
|
+
if finder_hash[:conditions].blank? || finder_hash[:conditions].is_a?(Hash)
|
74
74
|
conditions = {}
|
75
75
|
|
76
76
|
names.each_with_index do |name, index|
|
77
77
|
conditions[name.to_sym] = args[index]
|
78
78
|
end
|
79
79
|
|
80
|
-
finder_hash[:conditions] = conditions
|
80
|
+
finder_hash[:conditions] = {} if finder_hash[:conditions].blank?
|
81
|
+
finder_hash[:conditions].merge!(conditions)
|
81
82
|
|
82
83
|
else
|
83
84
|
conditions = []
|
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["naveenagarwal287@gmail.com"]
|
11
11
|
spec.description = %q{Overrides dynamic finders in ActiveRecord module to use new Activerecord relation metho}
|
12
12
|
spec.summary = %q{Overrides dynamic finders in ActiveRecord module to use new Activerecord relation metho}
|
13
|
-
spec.homepage = ""
|
13
|
+
spec.homepage = "https://github.com/naveenagarwal/override_dynamic_finders"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: override_active_record_dynamic_finders
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-10-
|
12
|
+
date: 2013-10-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -61,7 +61,7 @@ files:
|
|
61
61
|
- lib/override_active_record_dynamic_finders/class_methods.rb
|
62
62
|
- lib/override_active_record_dynamic_finders/version.rb
|
63
63
|
- override_active_record_dynamic_finders.gemspec
|
64
|
-
homepage:
|
64
|
+
homepage: https://github.com/naveenagarwal/override_dynamic_finders
|
65
65
|
licenses:
|
66
66
|
- MIT
|
67
67
|
post_install_message:
|