Problem with rails 2.1.0 & its older versions

hi to everyone .i am using rails 2.1.0 for my current project.in the
console mode i tried to excute the statement in console mode

User.find(:first,:select=>”name as text,id as value”).to_json

=> “{\”user\”: {\”text\”: \”thillai\”, \”value\”: \”1\”}}”

in rails 2.1.0 its giving the model name user also

but in rails 2.0.2 the results are coming as

{\”text\”: \”thillai\”, \”value\”: \”1\”}

as per my requirement i want results to be

{\”text\”: \”thillai\”, \”value\”: \”1\”}.

Is there any solution for this problem

On Jul 8, 10:45 am, Lost W. [email protected]
wrote:

{\”text\”: \”thillai\”, \”value\”: \”1\”}

as per my requirement i want results to be

{\”text\”: \”thillai\”, \”value\”: \”1\”}.

I would have thought that some_user.attributes.to_json would always
give you the second form.

Fred

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