Skip to content

Fix for issue #1 #5

Merged
merged 1 commit into from Apr 28, 2011
View
4 lib/puret/active_record_extensions.rb
@@ -42,6 +42,10 @@ def puret(*attributes)
translation ? translation[attribute] : nil
end
+
+ define_method "#{attribute}_before_type_cast" do
+ self.send(attribute)
+ end
end
end
View
4 test/puret_test.rb
@@ -118,4 +118,8 @@ def Post.default_locale() :sv; end
t2 = PostTranslation.new :post => post, :locale => "de"
assert_not_nil t2.errors[:locale]
end
+
+ test 'model should provide attribute_before_type_cast' do
+ assert_equal Post.first.title, Post.first.title_before_type_cast
+ end
end
Something went wrong with that request. Please try again.