nulogy-gettext_i18n_rails 0.5.0.2 → 0.5.0.3
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.
@@ -15,10 +15,11 @@ module GettextI18nRails::ActiveRecord
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def gettext_translation_for_attribute_name(attribute)
|
18
|
-
|
18
|
+
attribute = attribute.to_s
|
19
|
+
if attribute.ends_with?('_id')
|
19
20
|
humanize_class_name(attribute)
|
20
21
|
else
|
21
|
-
"#{self}|#{attribute.
|
22
|
+
"#{self}|#{attribute.split('.').map! {|a| a.humanize }.join('|')}"
|
22
23
|
end
|
23
24
|
end
|
24
25
|
end
|
@@ -14,9 +14,6 @@ if defined?(Rails::Railtie)
|
|
14
14
|
if app.config.gettext_i18n_rails.use_for_active_record_attributes
|
15
15
|
ActiveSupport.on_load :active_record do
|
16
16
|
extend GettextI18nRails::ActiveRecord
|
17
|
-
end
|
18
|
-
|
19
|
-
ActiveSupport.on_load :active_model do
|
20
17
|
require 'gettext_i18n_rails/active_model.rb'
|
21
18
|
end
|
22
19
|
end
|
@@ -27,7 +27,7 @@ describe ActiveRecord::Base do
|
|
27
27
|
|
28
28
|
describe :gettext_translation_for_attribute_name do
|
29
29
|
it "translates foreign keys to model name keys" do
|
30
|
-
Part.gettext_translation_for_attribute_name(
|
30
|
+
Part.gettext_translation_for_attribute_name(:car_seat_id).should == 'Car seat'
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|