@post.id to javascript

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!

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.

yes,

@posts.to_json(:only => [:id]) solved my problem.

Many thanks !