simple_model_translations 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock
CHANGED
@@ -7,16 +7,16 @@ PATH
|
|
7
7
|
GEM
|
8
8
|
remote: http://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activemodel (3.0.
|
11
|
-
activesupport (= 3.0.
|
10
|
+
activemodel (3.0.6)
|
11
|
+
activesupport (= 3.0.6)
|
12
12
|
builder (~> 2.1.2)
|
13
|
-
i18n (~> 0.
|
14
|
-
activerecord (3.0.
|
15
|
-
activemodel (= 3.0.
|
16
|
-
activesupport (= 3.0.
|
13
|
+
i18n (~> 0.5.0)
|
14
|
+
activerecord (3.0.6)
|
15
|
+
activemodel (= 3.0.6)
|
16
|
+
activesupport (= 3.0.6)
|
17
17
|
arel (~> 2.0.2)
|
18
18
|
tzinfo (~> 0.3.23)
|
19
|
-
activesupport (3.0.
|
19
|
+
activesupport (3.0.6)
|
20
20
|
arel (2.0.9)
|
21
21
|
builder (2.1.2)
|
22
22
|
database_cleaner (0.5.2)
|
@@ -33,8 +33,10 @@ GEM
|
|
33
33
|
rspec-core (~> 2.0.1)
|
34
34
|
rspec-expectations (~> 2.0.1)
|
35
35
|
shoulda (2.11.3)
|
36
|
-
sqlite3
|
37
|
-
|
36
|
+
sqlite3 (1.3.3)
|
37
|
+
sqlite3-ruby (1.3.3)
|
38
|
+
sqlite3 (>= 1.3.3)
|
39
|
+
tzinfo (0.3.26)
|
38
40
|
|
39
41
|
PLATFORMS
|
40
42
|
ruby
|
@@ -4,8 +4,4 @@ require 'simple_model_translations/class_methods'
|
|
4
4
|
require 'simple_model_translations/instance_methods'
|
5
5
|
require 'simple_model_translations/attributes'
|
6
6
|
require 'simple_model_translations/validations'
|
7
|
-
|
8
|
-
ActiveRecord::Base.extend SimpleModelTranslations::Base
|
9
|
-
ActiveRecord::Base.extend SimpleModelTranslations::Validations
|
10
|
-
|
11
|
-
|
7
|
+
require 'simple_model_translations/railtie' if defined?(Rails)
|
@@ -8,18 +8,19 @@ module SimpleModelTranslations
|
|
8
8
|
alias with_translation with_translations
|
9
9
|
|
10
10
|
def translation_class
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
11
|
+
@translation_class ||=
|
12
|
+
begin
|
13
|
+
Object.const_get(translation_class_name)
|
14
|
+
rescue NameError => e
|
15
|
+
klass = Object.const_set(translation_class_name, Class.new(ActiveRecord::Base))
|
16
|
+
klass.translation_for(name.underscore.to_sym)
|
17
|
+
klass.set_table_name(translation_class_name.to_s.underscore.pluralize)
|
18
|
+
klass
|
19
|
+
end
|
19
20
|
end
|
20
21
|
|
21
22
|
def translation_class_name
|
22
|
-
|
23
|
+
@translation_class_name ||= (translation_options[:class_name] || "#{self.name}Translation").to_sym
|
23
24
|
end
|
24
25
|
|
25
26
|
def translated_column_name(name)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'simple_model_translations'
|
2
|
+
require 'rails'
|
3
|
+
|
4
|
+
module SimpleModelTranslations
|
5
|
+
class Railtie < Rails::Railtie
|
6
|
+
initializer "simple_model_translations.active_record" do
|
7
|
+
ActiveSupport.on_load :active_record do
|
8
|
+
extend SimpleModelTranslations::Base
|
9
|
+
extend SimpleModelTranslations::Validations
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_model_translations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 8
|
10
|
+
version: 0.2.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Pavel Forkert
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-05-01 00:00:00 +03:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -121,6 +121,7 @@ files:
|
|
121
121
|
- lib/simple_model_translations/base.rb
|
122
122
|
- lib/simple_model_translations/class_methods.rb
|
123
123
|
- lib/simple_model_translations/instance_methods.rb
|
124
|
+
- lib/simple_model_translations/railtie.rb
|
124
125
|
- lib/simple_model_translations/translation_helper.rb
|
125
126
|
- lib/simple_model_translations/validations.rb
|
126
127
|
- lib/simple_model_translations/version.rb
|