activerecord-traits 1.0.1 → 1.0.2

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: bdc960c412f73aa79f3f666e6654185ce398b6a1
4
- data.tar.gz: 5afb7670fe9cfe16ab7ab8cc31e650b1b6561590
3
+ metadata.gz: 5a036911309ec08f65047cc51cef3c7599baab8d
4
+ data.tar.gz: da39b9604d3169ee2ab658c9187a8eb31d94ee84
5
5
  SHA512:
6
- metadata.gz: ff75cbae678809042dec2e2b0cdfdbf77f113bbf0f28efd804e0518abca5c4d34defd7b24c9f847031d68688ba25e825d4ffb5fbc886299e34d266f47a45a280
7
- data.tar.gz: beb6ae1de4639e06c8f4dc4295bf499ee69a9671b513ee8b64b02101854a828fdf96257d122cfd14af4534496e058d1034600602dab8862deab0b371bfaab8d5
6
+ metadata.gz: 3197336a5215c5ef877158f34895b0cb151abf8c4c201e47cd1fe56217a830eea0720e25dd0d7bb2e80787a68081c1257b2704cef58ffb809ecdef38d06ec5f2
7
+ data.tar.gz: a45aacb9e2721a52efef6d7dc77ee4092c93aac881a0f07645ba1ba03e7b425567212cad3d70b4774b7b5e529aaaac1ee693fd8dd13e5c2237e16f6acfb1ad51
@@ -27,7 +27,7 @@ module Traits
27
27
  elsif through?
28
28
  through_association.from_key_name
29
29
 
30
- elsif features.translates_with_globalize?
30
+ elsif features.try(:translates_with_globalize?)
31
31
  nil
32
32
 
33
33
  elsif belongs_to?
@@ -12,7 +12,7 @@ module Traits
12
12
 
13
13
  def foreign_key?
14
14
  attr_name = name
15
- attr_translates = model_class.attribute_features[attr_name].translates_with_globalize?
15
+ attr_translates = model_class.attribute_features[attr_name].try(:translates_with_globalize?)
16
16
 
17
17
  model.associations.any? do |assoc|
18
18
  if assoc.belongs_to?
@@ -5,7 +5,7 @@ module Traits
5
5
  class Attribute
6
6
  module Querying
7
7
  def arel
8
- table = if features.translates_with_globalize?
8
+ table = if features.try(:translates_with_globalize?)
9
9
  model_class.features.globalize.translation_model_class.arel_table
10
10
  else
11
11
  model.arel
data/lib/traits/model.rb CHANGED
@@ -62,7 +62,7 @@ module Traits
62
62
  else
63
63
  columns = model_class.columns_hash.values
64
64
 
65
- if features.translates_with_globalize?
65
+ if features.try(:translates_with_globalize?)
66
66
  globalize = features.globalize
67
67
  tr_class = globalize.model_class_for_translations
68
68
  tr_columns_hash = tr_class.columns_hash
@@ -3,7 +3,7 @@
3
3
 
4
4
  module Traits
5
5
  class Railtie < Rails::Railtie
6
- initializer do |app|
6
+ initializer 'traits' do |app|
7
7
  unless app.config.cache_classes
8
8
  ActionDispatch::Reloader.to_prepare do
9
9
  Traits.invalidate_loaded_active_record_descendants!
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Traits
5
- VERSION = '1.0.1'
5
+ VERSION = '1.0.2'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-traits
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yaroslav Konoplov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-20 00:00:00.000000000 Z
11
+ date: 2016-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport