i'm new to rails and i don't know how to do this simple operation :
i have ,
class Section < ActiveRecord::Base
has_many :articles
has_many :questions
end
class Article < ActiveRecord::Base
belongs_to :section
end
class Question < ActiveRecord::Base
belongs_to :section
end
and i want to get all articles and questions under a certain section but sorted together by shared column 'updated_at' .
i tried including and joining them but failed to order them together .
Aucun commentaire:
Enregistrer un commentaire