Skip to content

Initialize class attributes on inclusion #43

Merged
merged 1 commit into from Apr 5, 2012
View
5 lib/delocalize/delocalizable.rb
@@ -7,13 +7,12 @@ module Delocalizable
included do
class_attribute :delocalizable_fields
class_attribute :delocalize_conversions
+ self.delocalize_conversions = {}
+ self.delocalizable_fields = []
end
module ClassMethods
def delocalize(conversions = {})
- self.delocalize_conversions ||= {}
- self.delocalizable_fields ||= []
-
conversions.each do |field, type|
delocalizable_fields << field.to_sym unless delocalizable_fields.include?(field.to_sym)
delocalize_conversions[field.to_sym] = type.to_sym
Something went wrong with that request. Please try again.