Permalink
Browse files

removed unnecessary translator object

  • Loading branch information...
1 parent 857bd73 commit f86b19842620301b969a4a264c97e5e6ebc7b67f @tenderlove tenderlove committed Feb 8, 2012
@@ -1,5 +1,3 @@
-require 'active_record/attributes/translator'
-
module ActiveRecord
module AttributeMethods
module Read
@@ -139,20 +137,6 @@ def read_attribute(attr_name)
private
- def attribute_translator
- Attributes::Translator.new(@attributes, @columns_hash)
- end
-
- def cached_cast_attribute(attr_name, method)
- @attributes_cache[attr_name] ||= cast_attribute(attr_name, method)
- end
-
- def cast_attribute(attr_name, method)
- attribute_translator.cast_attribute(attr_name, method) do
- missing_attribute(attr_name, caller)
- end
- end
-
def attribute(attribute_name)
read_attribute(attribute_name)
end
@@ -1,28 +0,0 @@
-module ActiveRecord
- module Attributes
- class Translator # :nodoc:
- def initialize(attributes, column_types)
- @attributes = attributes
- @column_types = column_types
- end
-
- def cast_attribute(attr_name, method)
- v = @attributes.fetch(attr_name) { yield }
- v && send(method, attr_name, v)
- end
-
- def cast_serialized(attr_name, value)
- value.unserialized_value
- end
-
- def cast_tz_conversion(attr_name, value)
- value = cast_column(attr_name, value)
- value.acts_like?(:time) ? value.in_time_zone : value
- end
-
- def cast_column(attr_name, value)
- @column_types[attr_name].type_cast value
- end
- end
- end
-end

0 comments on commit f86b198

Please sign in to comment.