diff options
Diffstat (limited to 'vendor/plugins')
-rw-r--r-- | vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb | 6 | ||||
-rw-r--r-- | vendor/plugins/globalize2/lib/globalize/active_record.rb | 23 | ||||
-rwxr-xr-x | vendor/plugins/translate_routes/lib/tasks/translate_routes_tasks.rake (renamed from vendor/plugins/translate_routes/tasks/translate_routes_tasks.rake) | 0 |
3 files changed, 19 insertions, 10 deletions
diff --git a/vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb b/vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb index d8f0adaa3..2f66b68be 100644 --- a/vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb +++ b/vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb @@ -98,7 +98,7 @@ module ActsAsXapian # make the directory for the xapian databases to go in Dir.mkdir(db_parent_path) unless File.exists?(db_parent_path) - @@db_path = File.join(db_parent_path, environment) + @@db_path = File.join(db_parent_path, environment) # make some things that don't depend on the db # XXX this gets made once for each acts_as_xapian. Oh well. @@ -124,8 +124,8 @@ module ActsAsXapian begin @@db = Xapian::Database.new(@@db_path) @@enquire = Xapian::Enquire.new(@@db) - rescue IOError - raise "Xapian database not opened; have you built it with scripts/rebuild-xapian-index ?" + rescue IOError => e + raise "Failed to open Xapian database #{@@db_path}: #{e.message}" end init_query_parser diff --git a/vendor/plugins/globalize2/lib/globalize/active_record.rb b/vendor/plugins/globalize2/lib/globalize/active_record.rb index 2915a5737..3095bfe28 100644 --- a/vendor/plugins/globalize2/lib/globalize/active_record.rb +++ b/vendor/plugins/globalize2/lib/globalize/active_record.rb @@ -53,10 +53,16 @@ module Globalize extend ClassMethods, Migration after_save :save_translations! - has_many :translations, :class_name => translation_class.name, - :foreign_key => class_name.foreign_key, - :dependent => :delete_all, - :extend => HasManyExtensions + ActiveSupport::Deprecation.silence do + # Silence the warning that :class_name is deprecated and will be + # removed in Rails 3, since it clutters up e.g. test output, and + # there is nothing obvious that we can replace it with in Rails 2. + + has_many :translations, :class_name => translation_class.name, + :foreign_key => class_name.foreign_key, + :dependent => :delete_all, + :extend => HasManyExtensions + end named_scope :with_translations, lambda { |locale| conditions = required_attributes.map do |attribute| @@ -88,9 +94,12 @@ module Globalize delegate :set_translation_table_name, :to => :translation_class def with_locale(locale) - previous_locale, self.locale = self.locale, locale - result = yield - self.locale = previous_locale + begin + previous_locale, self.locale = self.locale, locale + result = yield + ensure + self.locale = previous_locale + end result end diff --git a/vendor/plugins/translate_routes/tasks/translate_routes_tasks.rake b/vendor/plugins/translate_routes/lib/tasks/translate_routes_tasks.rake index f94d7c9e4..f94d7c9e4 100755 --- a/vendor/plugins/translate_routes/tasks/translate_routes_tasks.rake +++ b/vendor/plugins/translate_routes/lib/tasks/translate_routes_tasks.rake |