baza_models 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 559ac4422c97943f4d90db128a3ee939b7d81b5f
4
- data.tar.gz: 1e5d6e48878a1375650a6775d9e2183bcb2b53d4
3
+ metadata.gz: 41b3014ef7bfaa003989adca6bd3519a1bb0d39d
4
+ data.tar.gz: ddb7c5bcca43273eafc70f8d3035891d99fabc4a
5
5
  SHA512:
6
- metadata.gz: 97b3c4a05c69c616b7ba4eec678b1580a5cc9897bda2063c345f5245fa6340911b3b45558b0072b09b6c4c6ab1d7cba9ae8fe6bac6d283eea2e6cd3eb4341424
7
- data.tar.gz: 640af41b9b0ec119bdd0d1fb721d887c750337d2a87b4fb48ec80f05193f21a63c5f0d2bf4bf72a966ad6df9abe79edf98cc6169892a6af63028350ecc0dbca1
6
+ metadata.gz: cc3c5cb62e327692b20fd0d61e6c833c29dc28040758ff712395a4364a29ba5f0693fad335d7766b6a82fe622635c4de055266452d359fde9d17e20a91e8a751
7
+ data.tar.gz: 318d2e728ebbb1c882f61e55386dd6e4e342a06ce6635216c7ed01574a70ebce4fb2347918b8979470fa2b5142dc7e811582dcb0dba781982b0a095eae803d1d
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.8
1
+ 0.0.9
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: baza_models 0.0.8 ruby lib
5
+ # stub: baza_models 0.0.9 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "baza_models"
9
- s.version = "0.0.8"
9
+ s.version = "0.0.9"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["kaspernj"]
14
- s.date = "2016-07-07"
14
+ s.date = "2016-08-10"
15
15
  s.description = "ActiveRecord like models for the Baza database framework"
16
16
  s.email = "k@spernj.org"
17
17
  s.extra_rdoc_files = [
@@ -57,6 +57,7 @@ Gem::Specification.new do |s|
57
57
  "lib/baza_models/query/pagination.rb",
58
58
  "lib/baza_models/query/sql_generator.rb",
59
59
  "lib/baza_models/ransacker.rb",
60
+ "lib/baza_models/ransacker/context.rb",
60
61
  "lib/baza_models/ransacker/relationship_scanner.rb",
61
62
  "lib/baza_models/test_database_cleaner.rb",
62
63
  "lib/baza_models/validators.rb",
@@ -103,7 +104,7 @@ Gem::Specification.new do |s|
103
104
  ]
104
105
  s.homepage = "http://github.com/kaspernj/baza_models"
105
106
  s.licenses = ["MIT"]
106
- s.rubygems_version = "2.2.2"
107
+ s.rubygems_version = "2.4.0"
107
108
  s.summary = "ActiveRecord like models for the Baza database framework"
108
109
 
109
110
  if s.respond_to? :specification_version then
@@ -379,8 +379,8 @@ class BazaModels::Query
379
379
  "'#{@db.esc(value)}'"
380
380
  end
381
381
 
382
- def ransack(params)
383
- BazaModels::Ransacker.new(class: @model, params: params, query: self)
382
+ def ransack(params, args = {})
383
+ BazaModels::Ransacker.new(class: @model, params: params, query: self, args: args)
384
384
  end
385
385
 
386
386
  private
@@ -5,11 +5,13 @@ class BazaModels::Ransacker
5
5
  attr_reader :db, :klass
6
6
 
7
7
  def initialize(args)
8
+ @args = args.fetch(:args)
8
9
  @klass = args.fetch(:class)
9
10
  @db = @klass.db
10
11
  @params = args.fetch(:params)
11
12
  @_registered_params = @params # Support for SimpleFormRansack
12
13
  @query = args.fetch(:query)
14
+ @search_key = @args[:search_key] || :q
13
15
  end
14
16
 
15
17
  def result
@@ -17,6 +19,10 @@ class BazaModels::Ransacker
17
19
  @query
18
20
  end
19
21
 
22
+ def context
23
+ BazaModels::Ransacker::Context.new(search_key: @search_key)
24
+ end
25
+
20
26
  private
21
27
 
22
28
  def add_filters_to_query
@@ -0,0 +1,7 @@
1
+ class BazaModels::Ransacker::Context
2
+ attr_reader :search_key
3
+
4
+ def initialize(args)
5
+ @search_key = args.fetch(:search_key)
6
+ end
7
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: baza_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - kaspernj
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-07 00:00:00.000000000 Z
11
+ date: 2016-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: array_enumerator
@@ -280,6 +280,7 @@ files:
280
280
  - lib/baza_models/query/pagination.rb
281
281
  - lib/baza_models/query/sql_generator.rb
282
282
  - lib/baza_models/ransacker.rb
283
+ - lib/baza_models/ransacker/context.rb
283
284
  - lib/baza_models/ransacker/relationship_scanner.rb
284
285
  - lib/baza_models/test_database_cleaner.rb
285
286
  - lib/baza_models/validators.rb
@@ -343,7 +344,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
343
344
  version: '0'
344
345
  requirements: []
345
346
  rubyforge_project:
346
- rubygems_version: 2.2.2
347
+ rubygems_version: 2.4.0
347
348
  signing_key:
348
349
  specification_version: 4
349
350
  summary: ActiveRecord like models for the Baza database framework