Closed
Description
If you have an attribute called "test" on your model it will throw an exception
There is a "test" method from the kernel on Serializer so when serializing in the attributes instance method of ActiveModel::Serializer you'll get
ArgumentError:
wrong number of arguments (0 for 2..3)
# /home/vagrant/.rvm/gems/ruby-2.1.1/bundler/gems/active_model_serializers-1f08865a10bb/lib/active_model/serializer.rb:156:in `test'
# /home/vagrant/.rvm/gems/ruby-2.1.1/bundler/gems/active_model_serializers-1f08865a10bb/lib/active_model/serializer.rb:156:in `block in attributes'
The source of the test method is
ruby-2.1.1-p76 (#<BaseSerializer:0x0000000afe8e40>):0 > show-source self.test
From: file.c (C Method):
Owner: Kernel
Visibility: private
Number of lines: 137
static VALUE
rb_f_test(int argc, VALUE *argv)
{
int cmd;
if (argc == 0) rb_check_arity(argc, 2, 3);
cmd = NUM2CHR(argv[0]);
if (cmd == 0) {
Digging into the implementation of ActiveModel Serializer it's apparent that any attribute with the same name as a method on the Serializer will have similar issues.
Metadata
Metadata
Assignees
Labels
No labels