i18n_generators 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -41,7 +41,9 @@ class I18nTranslationGenerator < Rails::Generators::NamedBase
41
41
 
42
42
  private
43
43
  def models
44
- @models ||= ActiveRecord::Base.descendants.map do |m|
44
+ ar_descendants = ActiveRecord::Base.descendants
45
+ ar_descendants.delete(ActiveRecord::SchemaMigration) if defined?(ActiveRecord::SchemaMigration)
46
+ @models ||= ar_descendants.map do |m|
45
47
  begin
46
48
  m if m.table_exists? && m.respond_to?(:content_columns)
47
49
  rescue => e
@@ -52,14 +54,14 @@ class I18nTranslationGenerator < Rails::Generators::NamedBase
52
54
  end
53
55
 
54
56
  def model_names_keys
55
- models.map {|m| "activerecord.models.#{m.model_name.underscore}"}
57
+ models.map {|m| "activerecord.models.#{m.model_name.to_s.underscore}"}
56
58
  end
57
59
 
58
60
  def content_column_names_keys
59
61
  models.map {|m|
60
62
  cols = m.content_columns.map {|c| c.name}
61
63
  cols.delete_if {|c| %w[created_at updated_at].include? c} unless include_timestamps?
62
- cols.map {|c| "activerecord.attributes.#{m.model_name.underscore}.#{c}"}
64
+ cols.map {|c| "activerecord.attributes.#{m.model_name.to_s.underscore}.#{c}"}
63
65
  }.flatten
64
66
  end
65
67
 
@@ -67,7 +69,7 @@ class I18nTranslationGenerator < Rails::Generators::NamedBase
67
69
  ret = {}
68
70
  models.each do |m|
69
71
  m.reflect_on_all_associations.select {|c| !c.collection?}.each do |c|
70
- ret["activerecord.attributes.#{m.model_name.underscore}.#{c.name}"] = "activerecord.models.#{c.name}".to_sym
72
+ ret["activerecord.attributes.#{m.model_name.to_s.underscore}.#{c.name}"] = "activerecord.models.#{c.name}".to_sym
71
73
  end
72
74
  end
73
75
  ret
@@ -75,7 +77,7 @@ class I18nTranslationGenerator < Rails::Generators::NamedBase
75
77
 
76
78
  def collection_reflection_names_keys
77
79
  models.map {|m|
78
- m.reflect_on_all_associations.select {|c| c.collection?}.map {|c| "activerecord.attributes.#{m.model_name.underscore}.#{c.name}"}
80
+ m.reflect_on_all_associations.select {|c| c.collection?}.map {|c| "activerecord.attributes.#{m.model_name.to_s.underscore}.#{c.name}"}
79
81
  }.flatten
80
82
  end
81
83
 
@@ -1,3 +1,3 @@
1
1
  module I18nGenerators
2
- VERSION = '1.2.0'
2
+ VERSION = '1.2.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n_generators
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-13 00:00:00.000000000 Z
12
+ date: 2012-05-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mechanize
16
- requirement: &2164523840 !ruby/object:Gem::Requirement
16
+ requirement: &70124690800140 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2164523840
24
+ version_requirements: *70124690800140
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rails
27
- requirement: &2164538720 !ruby/object:Gem::Requirement
27
+ requirement: &70124690822220 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 3.0.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2164538720
35
+ version_requirements: *70124690822220
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rails
38
- requirement: &2164538120 !ruby/object:Gem::Requirement
38
+ requirement: &70124690831120 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2164538120
46
+ version_requirements: *70124690831120
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
- requirement: &2164537160 !ruby/object:Gem::Requirement
49
+ requirement: &70124690828200 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2164537160
57
+ version_requirements: *70124690828200
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rake
60
- requirement: &2164536700 !ruby/object:Gem::Requirement
60
+ requirement: &70124690827340 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2164536700
68
+ version_requirements: *70124690827340
69
69
  description: A Rails generator plugin & gem that generates Rails I18n locale files
70
70
  for almost every known locale.
71
71
  email:
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  version: '0'
121
121
  requirements: []
122
122
  rubyforge_project: i18n_generators
123
- rubygems_version: 1.8.17
123
+ rubygems_version: 1.8.16
124
124
  signing_key:
125
125
  specification_version: 3
126
126
  summary: Generates I18n locale files for Rails 3 and Rails 2