Displaying 1 result from an estimated 1 matches for "with_nth_version".
2010 Jun 20
0
ActiveRecord and ARel: correlated subqueries?
...where(versions[:article_id].eq(articles[:id]))))
That doesn''t help me much in the context of ActiveRecord. There, I''d
like to define things like this
class Article < ActiveRecord::Base
has_many :versions
has_one :version
scope :with_latest_version, ...
scope :with_nth_version, lambda { |n| ... }
end
class Version < ActiveRecord::Base
scope :latest, ...
end
In Rails 2.3.8, I have defined all this with the judicious help of some
SQL. In Rails 3 I''d like to use ARel.
If you''re wondering what the point of Article#version is: it points to a
versio...