custom_query_methods 0.1.5 → 0.1.7

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
  SHA256:
3
- metadata.gz: 3e0b6c6ec8dd95a12e4fa0929123d3256930337b4d733472f20fba24be360237
4
- data.tar.gz: c1feb066122e51b0a2c9109af268e4cc99508b4af0d1483cf106c338a4da67b9
3
+ metadata.gz: fbc05abda57ad4ba15bc8993b744a14f147eb98fa4890f18992fc880d3e9cec8
4
+ data.tar.gz: 7708dd9e22545ae130bb789825d552901c181d91393116e63e5b28b5c23e3fb9
5
5
  SHA512:
6
- metadata.gz: 83140f7c4621c8c689b25abf1a2935493ec66473e82230629ee65fe98e440640e1f89f82aac261bfb8ca145f3c1ee6473095e240e933381d6b44917ce0364f7b
7
- data.tar.gz: b1fc538f03aee3960460e48bda2ae0450d1f76fc5e8a443983b21360762008533d688fdd69f105f2c50b6291c21e1be713d0542b9d13bdb8e8bdf8676159d8fd
6
+ metadata.gz: 575d9f93d9dcac045e28c58e8d2efb96fe4b520120f0b20fcd0035db7d990af928c6f6ba8011195a63b7ecebe21438fa4c7d99b106f5d11e3b72a8cc91947b57
7
+ data.tar.gz: d434c8784051c2044cd0cb0afed4046dba56b90beb9f505b7beeef484238d98809c16bb49cf850d6dd3f82ab317b21eee7a9e686ee30d3aefd6c1079b53fe34e
Binary file
Binary file
Binary file
@@ -0,0 +1,20 @@
1
+ module CustomQueryMethods
2
+ module ActiveRecord
3
+ def where_bind(opts = :chain, *rest)
4
+ if :chain == opts
5
+ ::ActiveRecord::QueryMethods::WhereChain.new(spawn)
6
+ elsif opts.blank?
7
+ self
8
+ else
9
+ spawn.where_bind!(opts, *rest)
10
+ end
11
+ end
12
+
13
+ def where_bind!(opts, *rest) # :nodoc:
14
+ opts = sanitize_forbidden_attributes(opts)
15
+ references!(::ActiveRecord::PredicateBuilder.references(opts)) if Hash === opts
16
+ self.where_clause += where_clause_factory.build(opts, rest)
17
+ self
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,11 @@
1
+ require_relative 'active_record'
2
+
3
+ module CustomQueryMethods
4
+ class Railtie < Rails::Railtie
5
+ initializer 'custom_query_methods' do
6
+ ActiveSupport.on_load(:active_record) do
7
+ ::ActiveRecord::Relation.include CustomQueryMethods::ActiveRecord
8
+ end
9
+ end
10
+ end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module CustomQueryMethods
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.7"
3
3
  end
@@ -1,7 +1,7 @@
1
1
  require "custom_query_methods/version"
2
- require "custom_query_methods/active_record_extension"
3
2
  require 'custom_query_methods/railtie'
4
3
 
4
+
5
5
  module CustomQueryMethods
6
6
  ActiveRecord::Base.include ActiveRecordExtension
7
7
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: custom_query_methods
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - tsotne
@@ -57,9 +57,13 @@ files:
57
57
  - custom_query_methods-0.1.1.gem
58
58
  - custom_query_methods-0.1.2.gem
59
59
  - custom_query_methods-0.1.3.gem
60
+ - custom_query_methods-0.1.4.gem
61
+ - custom_query_methods-0.1.5.gem
62
+ - custom_query_methods-0.1.6.gem
60
63
  - custom_query_methods.gemspec
61
64
  - lib/custom_query_methods.rb
62
- - lib/custom_query_methods/active_record_extension.rb
65
+ - lib/custom_query_methods/active_record.rb
66
+ - lib/custom_query_methods/railtie.rb
63
67
  - lib/custom_query_methods/version.rb
64
68
  homepage: http://example.com
65
69
  licenses:
@@ -1,7 +0,0 @@
1
- module CustomQueryMethods
2
- module ActiveRecordExtension
3
- def custom_where(*args)
4
- where('name LIKE ?', "%#{args.first}%")
5
- end
6
- end
7
- end