Results 1 to 4 of 4
Thread: more related table issues
Nov 11, 2007, 14:46 #1
more related table issues
I am trying to show data from a topics table that has a one to many relationship with a posts table. The following code only shows the the foreign key (expectedly.) How do I get this to show the topic in the topics table based on this foreign key?
<%= post.topic_id %>
Nov 11, 2007, 23:29 #2
You'll likely have to set up the associations in your models, so in post.rb:
Nov 12, 2007, 22:07 #3
I actually have belongs_to :topic in post.rb and has_many osts in topics.rb and have tried
My table is called topics and the only besides the id field is topic. And just for good measure I think I have tried every combination of that post.topics.title, post.topics_id.title
Not sure what I am doing wrong. Thanks for your help
Nov 12, 2007, 22:36 #4
- Join Date
- Jan 2006
- 0 Post(s)
- 0 Thread(s)
can you please provide us with the start of your post.rb, topic.rb, a description of your tables and where you're trying to make these calls?
Code makes it much easier to help you
ThanksIf you give someone a program,
you will frustrate them for a day;
if you teach them how to program,
you will frustrate them for a lifetime.