Displaying 1 result from an estimated 1 matches for "find_with_author".
2006 Nov 04
2
adding a method to an ActiveRecord Object
...bject 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
-------------- next part --------------
An HTML attachm...