# To\_json failing with column named test

**URL:** <https://www.ruby-forum.com/t/to-json-failing-with-column-named-test/183554>\
**Category:** Rails\
**Created:** [February 16, 2010, 2:05pm UTC](https://www.ruby-forum.com/t/to-json-failing-with-column-named-test/183554 "2010-02-16T14:05:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![raphael\_b](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/7c8e57/32.png) [@raphael\_b](https://www.ruby-forum.com/u/raphael_b)\
**Post date:** [February 16, 2010, 2:05pm UTC](https://www.ruby-forum.com/t/to-json-failing-with-column-named-test/183554/1 "2010-02-16T14:05:47Z")

</div>

Hi,

I have a model with a column named test, which causes trouble to  
to\_json.

The problems comes from this line

> <https://github.com/rails/rails/blob/2-3-stable/activerecord/lib/active_record/serialization.rb#LID78>

serializable\_names.each { |name| serializable\_record[name] =  
@record.send(name) }

and more specifically the call to send with the column name passed as  
argument. The problem comes from the fact that test is an already  
defined private method, which is then called rather than the expected  
accessor…

I’ve tested it with this code

serializable\_names.each { |name| serializable\_record[name] =  
@record[name] }

and it works fine, but no accessor would be used then.

Anyone having a suggestion for a solution?

Thanks

Raphaël

–  
Web database: [http://www.myowndb.com](http://www.myowndb.com)  
Free Software Developers Meeting: [http://www.fosdem.org](http://www.fosdem.org)
