On Jul 8, 10:45 am, Lost Warrior
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> 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\”}.
I would have thought that some_user.attributes.to_json would always
give you the second form.
Fred
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---