Hey all,
I'm not positive if this is a Engines bug, but it seems very peculiar and a few hours of Googling haven't given me any good leads yet, so I thought I'd see if it makes sense to any of you:
I am writing a new version of the savage_beast plugin (implements Beast forums as a plugin) that's Rails 2.0 compatible, and I am having trouble with the many models in the plugin that refer to the User model (which lives in my project). For example, my Post class (part of the savage_beast plugin) has
class Post < ActiveRecord::Base belongs_to :forum belongs_to :user belongs_to :topic
... end
I can set the forum, user, and topic for this class fine, and they save without issue. However, when I go to access the user association later on, I can only get its database fields, not any of the methods that are defined in the User model. That is,
@post.user[:some_database_attribute] will display fine @post.user.any_method_at_all will give me a "No method found" error.
If I check what kind of class @post.user is, Ruby will report it is a "User" class. I have tried to hack around this by doing a "def user { User.find(user_id) }" in the plugin, but users are used as associations in numerous instances in numerous models, sometimes as has_many_throughs, so besides being ugly, I don't think this hack is going to be viable across the board (though doing a User.find of the user_id does return a model with methods intact).
Do any of you have any suggestions about how I could fix (or start to debug) this issue?
Thanks, Bill Harding