Reputation: 2527
Ruby - 1.9.2 Rails - 3.1.1 MongoMapper - 0.9.1
Very weird. This code used to work fine. All of a sudden when you have things like this, it breaks:
class MyClass
def self.test
MyClass.all
end
end
So I changed them to:
class MyClass
def self.test
self.all
end
end
And that fixed it, but now it's spawned this error:
NameError (uninitialized constant User::Message)
for this code:
def get_messages_with_user(user)
all_messages = Message.where(:$or => [{:sender_id => self.id, :recipient_id => user.id, :is_active => true}, {:sender_id => user.id, :recipient_id => self.id, :is_active => true}]).sort(:created_at.asc).all
all_messages.reject{ |message| message.sender == self && message.introducer_id.present? }
end
Any idea what that means??? The worst part is, if we deploy to Heroku, it doesn't happen. Only happens locally...
Upvotes: 0
Views: 492
Reputation: 2527
It seems as though something with requiring files is not right on our dev sytems.
Doing:
::Message.where...
Solved the problem.
Upvotes: 1