Hi there,
Rails 2.0.1 stable, mySQL
trying to access an object created through a function call :
Model 1 :
MyModel << ActiceRecord::Base
…
def stats
@stats ||= MyStats.new(self.id)
end
…
Model 2 :
MyStats < MyModel
…
def new(id)
self.id = id
self.all
end
def all
@all ||= OtherModel.find_by_my_model_id(self.id)
end
…
View :
<% for myModel in @list_of_myModels %>
<%=debug(myModel.stats)%>
throws "can’t dup Fixnum " error
likewise for :
<%=debug(@list_of_myModels[0].stats)%>
I led myself here : http://dev.rubyonrails.org/changeset/7399
But I’m confused. This seems an old patch.
any help appreciated.