Skip to content
Browse files

Make public .instantiate in AR integration

  • Loading branch information...
1 parent 84d78eb commit 7241f39b7c4eaed2de49bdf74275fc96e69adc07 @be9 be9 committed Dec 23, 2011
Showing with 8 additions and 8 deletions.
  1. +8 −8 lib/enumerated_attribute/integrations/active_record.rb
View
16 lib/enumerated_attribute/integrations/active_record.rb
@@ -75,14 +75,6 @@ def []=(attr_name, value); write_enumerated_attribute(attr_name, value); end
def attribute=(attr_name, value); write_enumerated_attribute(attr_name, value); end
module ClassMethods
- private
-
- def construct_attributes_from_arguments(attribute_names, arguments)
- attributes = {}
- attribute_names.each_with_index{|name, idx| attributes[name] = has_enumerated_attribute?(name) ? arguments[idx].to_s : arguments[idx]}
- attributes
- end
-
def instantiate(record)
object = super(record)
self.enumerated_attributes.each do |k,v|
@@ -93,6 +85,14 @@ def instantiate(record)
object
end
+ private
+
+ def construct_attributes_from_arguments(attribute_names, arguments)
+ attributes = {}
+ attribute_names.each_with_index{|name, idx| attributes[name] = has_enumerated_attribute?(name) ? arguments[idx].to_s : arguments[idx]}
+ attributes
+ end
+
def define_enumerated_attribute_new_method
class_eval do
class << self

0 comments on commit 7241f39

Please sign in to comment.
Something went wrong with that request. Please try again.