acts-as-taggable-array-on 0.5 → 0.5.1

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
  SHA256:
3
- metadata.gz: 6e9634fcc6fb7b4ddff2df2ae5e71bd237e89dcfbebdbec0cecc9d414d095821
4
- data.tar.gz: 33745344b55b6a5ec70e530d530ccab286e606cfa925dc3cc06899b9f0bba54d
3
+ metadata.gz: 9f7a6cf023c1dd9dd7f1d8e77db2772f2f673b233d5f2ad625115c0d28677879
4
+ data.tar.gz: 84d46e102ab941b3a1a99c85ed2897ef5b09785f1c40a65356365710d3f500cb
5
5
  SHA512:
6
- metadata.gz: d4ef02fa959e7e24bfd78eb338de5b7f05d6a139357766db145c158f547a31af119d9e9a566180fdb3764ee98484f962e0619e00bf61cb0fb62a981137a84ff6
7
- data.tar.gz: 75419a2e0d898ab7f6ce2a3a61e24298b8635e4a4bea5c3d87f95449b155bf260e42f53ff39470bccfd0d408e5ad195d09ac37885beff858f3419effa146e9a1
6
+ metadata.gz: 7e6efedde0a9883e69acad7fc544daca55f0c8cd6a447cd65cdc77ba4c47380c61d3b93eb51c9378b98bd753af086afa61b90375418acd93e98b77e7ef7ec1bb
7
+ data.tar.gz: 84e04cfc82640c5137aa59cecb8fbe7bd55d357509ac9fc3b8ae60b7eca25339f2fc933be711026bcc5e0511fc3af7c95ed290b0edd02247088e9578ac82d6ba
@@ -0,0 +1,6 @@
1
+ ## 0.5.1
2
+ - Don't fail during load time if DB is missing
3
+
4
+ ## 0.5
5
+ - Don't fail if table is not defined
6
+ - Defines columns ambiguously, so table joins would work
@@ -28,5 +28,4 @@ Gem::Specification.new do |spec|
28
28
  spec.add_development_dependency "rspec-rails"
29
29
  spec.add_development_dependency "guard-rspec"
30
30
  spec.add_development_dependency "listen", "~> 3.0.0"
31
- spec.add_development_dependency 'temping'
32
31
  end
@@ -9,15 +9,14 @@ module ActsAsTaggableArrayOn
9
9
  TYPE_MATCHER = { string: 'varchar', text: 'text', integer: 'integer' }
10
10
 
11
11
  module ClassMethod
12
- def acts_as_taggable_array_on(*tag_def)
13
- tag_name = tag_def.first
14
- tag_array_type = TYPE_MATCHER[columns_hash[tag_name.to_s].try(:type)]
12
+ def acts_as_taggable_array_on(tag_name, *)
13
+ tag_array_type_fetcher = -> { TYPE_MATCHER[columns_hash[tag_name.to_s].type] }
15
14
  parser = ActsAsTaggableArrayOn.parser
16
15
 
17
- scope :"with_any_#{tag_name}", ->(tags){ where("#{table_name}.#{tag_name} && ARRAY[?]::#{tag_array_type}[]", parser.parse(tags)) }
18
- scope :"with_all_#{tag_name}", ->(tags){ where("#{table_name}.#{tag_name} @> ARRAY[?]::#{tag_array_type}[]", parser.parse(tags)) }
19
- scope :"without_any_#{tag_name}", ->(tags){ where.not("#{table_name}.#{tag_name} && ARRAY[?]::#{tag_array_type}[]", parser.parse(tags)) }
20
- scope :"without_all_#{tag_name}", ->(tags){ where.not("#{table_name}.#{tag_name} @> ARRAY[?]::#{tag_array_type}[]", parser.parse(tags)) }
16
+ scope :"with_any_#{tag_name}", ->(tags) { where("#{table_name}.#{tag_name} && ARRAY[?]::#{tag_array_type_fetcher.call}[]", parser.parse(tags)) }
17
+ scope :"with_all_#{tag_name}", ->(tags) { where("#{table_name}.#{tag_name} @> ARRAY[?]::#{tag_array_type_fetcher.call}[]", parser.parse(tags)) }
18
+ scope :"without_any_#{tag_name}", ->(tags) { where.not("#{table_name}.#{tag_name} && ARRAY[?]::#{tag_array_type_fetcher.call}[]", parser.parse(tags)) }
19
+ scope :"without_all_#{tag_name}", ->(tags) { where.not("#{table_name}.#{tag_name} @> ARRAY[?]::#{tag_array_type_fetcher.call}[]", parser.parse(tags)) }
21
20
 
22
21
  self.class.class_eval do
23
22
  define_method :"all_#{tag_name}" do |options = {}, &block|
@@ -1,3 +1,3 @@
1
1
  module ActsAsTagPgarray
2
- VERSION = "0.5"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -14,12 +14,8 @@ describe ActsAsTaggableArrayOn::Taggable do
14
14
 
15
15
  context "without database table" do
16
16
  it "doesn't fail on class method call" do
17
- Temping.create :dummy
18
-
19
17
  class Dummy < ActiveRecord::Base; end
20
18
  Dummy.acts_as_taggable_array_on :tags
21
-
22
- Temping.teardown
23
19
  end
24
20
  end
25
21
 
@@ -2,7 +2,6 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
2
  $LOAD_PATH.unshift(File.dirname(__FILE__))
3
3
  require 'rspec'
4
4
  require 'active_record/railtie'
5
- require 'temping'
6
5
  ActiveRecord::Base.logger = Logger.new(STDERR)
7
6
  ActiveRecord::Base.logger.level = 3
8
7
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts-as-taggable-array-on
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.5'
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takuya Miyamoto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-02 00:00:00.000000000 Z
11
+ date: 2018-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -122,20 +122,6 @@ dependencies:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: 3.0.0
125
- - !ruby/object:Gem::Dependency
126
- name: temping
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
125
  description: Simple tagging gem for Rails using postgres array.
140
126
  email:
141
127
  - miyamototakuya@gmail.com
@@ -146,6 +132,7 @@ files:
146
132
  - ".editorconfig"
147
133
  - ".gitignore"
148
134
  - ".travis.yml"
135
+ - CHANGELOG.md
149
136
  - Gemfile
150
137
  - Guardfile
151
138
  - LICENSE.txt