Join GitHub today
SystemStackError: stack level too deep #55
Hi, I was shifting my rails application from mongoDB to rethinkDB.
My getters have stopped working and are throwing a stack level too deep error.
For example :
class User include NoBrainer::Document field :year def year self[:year] end end
Earlier with MongoDB this worked fine and only threw a stack level too deep error, when
This means that
This behavior is interesting to ensure that an operation like
That is interesting. Is there a way to fix this ?
Here is a link that might help you get the problem I'm going through.
Also I tried all three methods none of them worked.
I see. So the correct way to do it with nobrainer is to use
class User include NoBrainer::Document field :year def year super end end
It doesn't make much sense to me that
class User include NoBrainer::Document field :year def year=(value) super(value.to_i) end end
This piece of code would always call
This way you get a much more consistent behavior when accessing model attributes. There is no way to bypass the user defined getter/setters, which I think is a good thing. I probably should document heavily this behavior though, because it will surprise more people.