i18n_konjac 0.0.4 → 0.0.5
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 +4 -4
- data/lib/i18n_konjac/acts_as_konjac.rb +9 -6
- data/lib/i18n_konjac/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a007a69ba06df79648a1b522f6cbbb93857ae0a0
|
|
4
|
+
data.tar.gz: caac75d4b9abb80a25605a84dc608f37a62690c3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4d3cdaa388e4991f10f3e893b78d299fb6e30815870ffb7e9ba28a38ba303866603d436087469defc0593dec093f588dbb07b3a0cacd24ebd2fcb3e0d29ce60f
|
|
7
|
+
data.tar.gz: 73f6a105ff52529adf44a4033dbd042e7a0712ec4be7eaa5ba8dd1a892f2f9b26197eca4b4c49e31f93512047d703165aef37918980ce3911d6c8aff633cb627
|
|
@@ -3,18 +3,21 @@ module I18nKonjac
|
|
|
3
3
|
extend ActiveSupport::Concern
|
|
4
4
|
|
|
5
5
|
module ClassMethods
|
|
6
|
-
def acts_as_konjac(
|
|
6
|
+
def acts_as_konjac(*args)
|
|
7
7
|
include I18nKonjac::ActsAsKonjac::LocalInstanceMethods
|
|
8
8
|
|
|
9
9
|
return unless ActiveRecord::Base.connection.table_exists? self.to_s.pluralize.underscore
|
|
10
10
|
|
|
11
|
-
self.column_names
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
attrs = self.column_names
|
|
12
|
+
attrs = attrs + args if args.present?
|
|
13
|
+
|
|
14
|
+
attrs.each do |attr|
|
|
15
|
+
define_method "#{attr}_by_locale" do
|
|
16
|
+
val = if self.attribute_present?("#{current_prefix}#{attr}")
|
|
17
|
+
self.send("#{current_prefix}#{attr}")
|
|
15
18
|
end
|
|
16
19
|
|
|
17
|
-
val.presence || self.send("#{
|
|
20
|
+
val.presence || self.send("#{attr}")
|
|
18
21
|
end
|
|
19
22
|
end
|
|
20
23
|
end
|
data/lib/i18n_konjac/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: i18n_konjac
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- yaboojp
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-03-
|
|
11
|
+
date: 2018-03-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|