mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Remove unneeded method aliasing of attribute reader: object, with the underscored class name of serializer, to fix issue where a model's attribute name matches that of the underscored prefix of the serializer
This commit is contained in:
@@ -29,6 +29,17 @@ class SerializerTest < ActiveModel::TestCase
|
||||
}, hash)
|
||||
end
|
||||
|
||||
def test_attribute_method_with_name_as_serializer_prefix
|
||||
object = SomeObject.new("something")
|
||||
object_serializer = SomeSerializer.new(object, {})
|
||||
|
||||
hash = object_serializer.as_json
|
||||
|
||||
assert_equal({
|
||||
:some => { :some => "something" }
|
||||
}, hash)
|
||||
end
|
||||
|
||||
def test_serializer_receives_scope
|
||||
user = User.new
|
||||
user_serializer = UserSerializer.new(user, :scope => {:scope => true})
|
||||
|
||||
Reference in New Issue
Block a user