3

Actually when i try to access a question using serel gem(which is a ruby wrapper for stackoverflow api), i get an object with no body parameter included in it.

questions = Serel::Question.find(id)

see http://api.stackoverflow.com/1.1/usage/methods/questions-by-ids. According to this, we need to turn the body parameter true.

How to turn the parameter "body" true.

2 Answers2

3

So I finally figured it out, this should work for you:

Serel::Question.filter(:withbody).find(id)
marcamillion
  • 32,933
  • 55
  • 189
  • 380
0

Try this:

 questions = Serel::Question.find(id).body.get
Rahul Tapali
  • 9,887
  • 7
  • 31
  • 44
  • This doesnt work as body is nil class. see the error `1.9.3p194 :003 > ques = Serel::Question.find(14779466).body.get [INFO][2013-02-10 10:58:30] Making request to /2.0/questions/14779466?site=stackoverflow&key=Sd9owvzqRd%29VnsNfrCAJwA%28%28 NoMethodError: undefined method `get' for nil:NilClass from (irb):3 from /home/papri/.rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `
    ' 1.9.3p194 :004 > ques = Serel::Question.find(14779466)`
    – Prateek Papriwal Feb 10 '13 at 05:33