It would be nice if there was a more elegant way to do this, given these models:
@forum_topic = ForumTopic.find(1) @forum_topic.forum_sub_topics.each do |fst|
It seems unnecessary to include forum_ in front of sub_topics, because I know that I am dealing with forum_topic. I could change the table / model name to SubTopic, but this is a bit common and might appear somewhere in the application. Is there a way to override the name of methods created in ForumTopic for the has_many association?
Models:
class ForumTopic... has_many :forum_sub_topics end class ForumSubTopic... end
And here is the answer right here. Thank you! :) http://guides.rubyonrails.org/association_basics.html
source share