Merge pull request #1737 from chancancode/add_missing_references

Added some missing references
This commit is contained in:
Régis Hanol 2013-12-23 05:51:04 -08:00
commit 0b13b8d7ea
2 changed files with 2 additions and 4 deletions

View File

@ -61,10 +61,7 @@ class Post < ActiveRecord::Base
end end
def self.find_by_detail(key, value) def self.find_by_detail(key, value)
includes(:post_details).where( "post_details.key = ? AND " + includes(:post_details).where(post_details: { key: key, value: value }).first
"post_details.value = ?",
key,
value ).first
end end
def add_detail(key, value, extra = nil) def add_detail(key, value, extra = nil)

View File

@ -242,6 +242,7 @@ class TopicQuery
else else
result = result.where('topics.category_id IS NULL') result = result.where('topics.category_id IS NULL')
end end
result = result.references(:categories)
end end
result result