Fix ActiveRecord queries - take two
This commit is contained in:
parent
79b7d38158
commit
033e8e5cb6
2 changed files with 2 additions and 2 deletions
|
|
@ -85,7 +85,7 @@ class Person < ActiveRecord::Base
|
||||||
where(:aspect_memberships => {:aspect_id => aspect_ids})
|
where(:aspect_memberships => {:aspect_id => aspect_ids})
|
||||||
}
|
}
|
||||||
|
|
||||||
scope :profile_tagged_with, lambda{|tag_name| joins(:profile => :tags).where(:profile => {:tags => {:name => tag_name}}).where('profiles.searchable IS TRUE') }
|
scope :profile_tagged_with, lambda{|tag_name| joins(:profile => :tags).where(:tags => {:name => tag_name}).where('profiles.searchable IS TRUE') }
|
||||||
|
|
||||||
scope :who_have_reshared_a_users_posts, lambda{|user|
|
scope :who_have_reshared_a_users_posts, lambda{|user|
|
||||||
joins(:posts).where(:posts => {:root_guid => StatusMessage.guids_for_author(user.person), :type => 'Reshare'} )
|
joins(:posts).where(:posts => {:root_guid => StatusMessage.guids_for_author(user.person), :type => 'Reshare'} )
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ class TagFollowing < ActiveRecord::Base
|
||||||
validates_uniqueness_of :tag_id, :scope => :user_id
|
validates_uniqueness_of :tag_id, :scope => :user_id
|
||||||
|
|
||||||
def self.user_is_following?(user, tagname)
|
def self.user_is_following?(user, tagname)
|
||||||
tagname.nil? ? false : joins(:tag).where(:tags => {:name => tagname.downcase}, :user_id => user.id).exists?
|
tagname.nil? ? false : joins(:tag).where(:tags => {:name => tagname.downcase}).where(:user_id => user.id).exists?
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue