summaryrefslogtreecommitdiff
path: root/vendor/plugins
diff options
context:
space:
mode:
authorhukl <contact@smyck.org>2009-03-28 18:09:33 +0100
committerhukl <contact@smyck.org>2009-03-28 18:09:33 +0100
commit2eec891c3c738eba46df41520d477322d8e6ea6b (patch)
treeba3d64fc07740f717b2835b5bb4ae8cf8489bfbd /vendor/plugins
parent4993909e278731463010ef45211cd22ef1b2794c (diff)
fix for globalize to honor the use of :include => :globalize_translations. also see
http://github.com/hukl/globalize2/commit/e0935a0a6c0c7305e575d3a9962229bd5f44cb1a
Diffstat (limited to 'vendor/plugins')
-rw-r--r--vendor/plugins/globalize2/lib/globalize/model/active_record/adapter.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/vendor/plugins/globalize2/lib/globalize/model/active_record/adapter.rb b/vendor/plugins/globalize2/lib/globalize/model/active_record/adapter.rb
index d1c8db8..71faebd 100644
--- a/vendor/plugins/globalize2/lib/globalize/model/active_record/adapter.rb
+++ b/vendor/plugins/globalize2/lib/globalize/model/active_record/adapter.rb
@@ -63,9 +63,17 @@ module Globalize
63 63
64 def fetch_attribute(locale, attr_name) 64 def fetch_attribute(locale, attr_name)
65 fallbacks = I18n.fallbacks[locale].map{|tag| tag.to_s}.map(&:to_sym) 65 fallbacks = I18n.fallbacks[locale].map{|tag| tag.to_s}.map(&:to_sym)
66 translations = @record.globalize_translations.by_locales(fallbacks) 66
67 # If the translations were included with
68 # :include => globalize_translations
69 # there is no need to query them again.
70 unless @record.globalize_translations.loaded?
71 translations = @record.globalize_translations.by_locales(fallbacks)
72 else
73 translations = @record.globalize_translations
74 end
67 result, requested_locale = nil, locale 75 result, requested_locale = nil, locale
68 76
69 # Walk through the fallbacks, starting with the current locale itself, and moving 77 # Walk through the fallbacks, starting with the current locale itself, and moving
70 # to the next best choice, until we find a match. 78 # to the next best choice, until we find a match.
71 # Check the @globalize_set_translations cache first to see if we've just changed the 79 # Check the @globalize_set_translations cache first to see if we've just changed the