serel
serel copied to clipboard
Specific question not responding to `get`
For some reason, this specific question is throwing an error:
> Serel::Question.find(55984).get
[INFO][2013-04-01 14:32:11] Making request to /2.0/questions/55984?site=stackoverflow&key=kljhalwkjenlansd
NameError: undefined local variable or method `name' for #<Serel::Question:0x007f8a449a6458>
from /gems/ruby-1.9.3-p392@myapp/gems/serel-1.2.0/lib/serel/base.rb:161:in `get'
from (irb):7
from /gems/ruby-1.9.3-p392@myapp/gems/railties-3.2.12/lib/rails/commands/console.rb:47:in `start'
from /gems/ruby-1.9.3-p392@myapp/gems/railties-3.2.12/lib/rails/commands/console.rb:8:in `start'
from /gems/ruby-1.9.3-p392@myapp/gems/railties-3.2.12/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Not quite sure why this question, but here is the question on SO: http://stackoverflow.com/questions/55984/what-is-the-difference-between-const-and-readonly
Also, if I removed the get
, here is the record:
> Serel::Question.find(55984)
[INFO][2013-04-01 14:40:20] Making request to /2.0/questions/55984?site=stackoverflow&key=lkjhalskdhalklkjhskladj
=> #<Serel::Question:70115916335560 @question_id=55984, @last_edit_date=2009-11-15 17:08:09 -0500, @creation_date=2008-09-11 03:02:19 -0500, @last_activity_date=2013-01-21 12:00:16 -0500, @score=255, @answer_count=21, @accepted_answer_id=56024, @title=What is the difference between const and readonly?, @tags=["c#", ".net", "const", "constants", "readonly"], @view_count=36924, @link=http://stackoverflow.com/questions/55984/what-is-the-difference-between-const-and-readonly, @is_answered=true @owner=#<Serel::User:70115916345140>>
Edit 1: I am seeing this error more and more in other questions.
It's fun that it's so long since I worked with this code I'm struggling myself.
First thoughts is that calling .get
on a singular instance seems wrong - every question I have tried this with errors, since find(id) is returning an instance of a class. name
is called on the class (rather than an instance) and returns the string form of the class name. Obviously it's a long time since this issue was filed, but what did you expect to happen when you called .get
?
I'm not entirely sure why .get
is even defined in base.