To_json failing with column named test

Hi,

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

The problems comes from this line

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
Free Software Developers Meeting: http://www.fosdem.org

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs