OK: I've read through this a million times and am still not getting it right. I have two tables (posts and authors), with a one(author) to many(posts) relationship, and the keys are not named id but user_name in one and screen_name in the other. I'm trying to join the tables in the model, then pull all fields from posts and one additional field from author, bio. Here is my stuff:
in models/post.rb class Post < ActiveRecord::Base has_one :authors, :primary_key => :user_name, :foreign_key => :screen_name end in controllers/posts.rb @postswithauthors = Post.find(:all, :limit => 20, :conditions =>"posted between '"+...@starthour+"' and '"+...@endhour+"' and searchterm='"+searchterm+"'", :order => "posted DESC", :include => :authors ) in the view/posts.rb for x in @postswithauthors puts x.user_name puts x.posted puts x.post puts x.authors.bio end Every time I run this I get something like invalid method "bio". Been over and over all of the association docs and can't find my error. Please help. Thanks...Chris -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.