I’ve already pulled my object from the database. Now I want to add a method. What I’m doing is adding the username to the activerecord object so I’ll have the name and user_id. How can I do this. The code below fails in the view. It appears it’s overwriting the rest of my object
def self.find_with_author(id) @article = Article.find(id) logger.error(“user id = #{@article.user_id}”)
@user = User.find(:first, :conditions => ["id = ?",@article.user_id
]) @article[‘author’] = @user.login end