aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/post.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-04-11 16:14:51 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2014-04-11 16:14:51 -0700
commit85f3a57a57b3c6d105e35936bf3ee972dc652902 (patch)
treebff7790eaeb0c336d24ebca1af93e9b3a9e33788 /activerecord/test/models/post.rb
parentdbc8c0ee36ddda7c27a375c78bbdb989fd30c298 (diff)
downloadrails-85f3a57a57b3c6d105e35936bf3ee972dc652902.tar.gz
rails-85f3a57a57b3c6d105e35936bf3ee972dc652902.tar.bz2
rails-85f3a57a57b3c6d105e35936bf3ee972dc652902.zip
propogate bind values collected in arel to SQL generation
Diffstat (limited to 'activerecord/test/models/post.rb')
-rw-r--r--activerecord/test/models/post.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/test/models/post.rb b/activerecord/test/models/post.rb
index 099e039255..d9ecaee1d9 100644
--- a/activerecord/test/models/post.rb
+++ b/activerecord/test/models/post.rb
@@ -40,6 +40,8 @@ class Post < ActiveRecord::Base
scope :with_comments, -> { preload(:comments) }
scope :with_tags, -> { preload(:taggings) }
+ scope :tagged_with, ->(id) { joins(:taggings).where(taggings: { tag_id: id }) }
+
has_many :comments do
def find_most_recent
order("id DESC").first