Hi, I''m trying to send the id''s of bunch of posts to javascript but instead of id''s I''m getting something like: #<Post:0x1044e7078>#<Post:0x1044e6fd8> What am I doing wrong ? Many thanks! -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
> I''m trying to send the id''s of bunch of posts to javascript but > instead of id''s I''m getting something like: > #<Post:0x1044e7078>#<Post:0x1044e6fd8> > > What am I doing wrong ?You''re sending the post itself. Without seeing your code it''s gonna be hard to provide more info. Guessing I''d say you maybe want... @posts.to_json or something. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
yes, @posts.to_json(:only => [:id]) solved my problem. Many thanks ! On Mar 4, 1:31 am, Philip Hallstrom <phi...-LSG90OXdqQE@public.gmane.org> wrote:> > I''m trying to send the id''s of bunch of posts to javascript but > > instead of id''s I''m getting something like: > > #<Post:0x1044e7078>#<Post:0x1044e6fd8> > > > What am I doing wrong ? > > You''re sending the post itself. Without seeing your code it''s gonna > be hard to provide more info. > > Guessing I''d say you maybe want... > > @posts.to_json > > or something.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.