i render some object using json:
def index
if user_signed_in?
@todos = current_user.todos.find_all()
render :json => @todos
else
return nil
end
end
it actually does that, but there's a problem. I get square brakets [ ] arround the json output and some plugins or json viewers cannot read it because of them. Here some sample output:
[{"todo":{"name":"Test todo","created_at":"2010-11-24T07:40:07Z","updated_at":"2010-11-24T07:40:07Z","done":0,"id":1,"user_id":1}},{"todo":{"name":"Ali Test","created_at":"2010-11-24T07:40:30Z","updated_at":"2010-11-24T07:40:30Z","done":0,"id":2,"user_id":1}}]
thanks in advance!