Displaying 2 results from an estimated 2 matches for "last_post".
Did you mean:
last_pos
2006 Jun 21
6
Sort table by child row property?
I''m building a simple forum system which features a topics and a posts
table. The topic model has a has_many association with the post model,
i.e.:
class Topic < ActiveRecord::Base {
has_many :posts
}
class Post < ActiveRecord:Base {
belongs_to :topic, :dependent => true
}
Now, I wish to sort the topics by the created_at property of the last
post, but I can''t
2006 Jun 19
0
has_one frustrations, please help!
...een bending my head around a has_one association for
about 3 hours now and I can''t get it to work. I''m pretty sure it''s not
something I''m overlooking anymore. Here''s the essential part of the
schema I''m working with:
-----
t :topics
c :id
c :last_post_id
t :posts
c :id
c :topic_id
-----
Topics are simply named containers for posts. I decided not to use
virtual tables since 99% of the columns would be topic-related. In the
topic model I have the following associations:
-----
has_many(:posts)
has_one(:last_post, {:class_name => ''P...