Skip to content

Commit

Permalink
Rails 3.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
atd committed Feb 28, 2011
1 parent 5c0452e commit 212f8c5
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/models/activity.rb
Expand Up @@ -96,7 +96,7 @@ def likes
end

def liked_by(user) #:nodoc:
likes.joins(:ties).where('tie_activities.original' => true) & Tie.received_by(user)
likes.joins(:ties).where('tie_activities.original' => true).merge(Tie.received_by(user))
end

# Does user like this activity?
Expand Down
6 changes: 3 additions & 3 deletions app/models/actor.rb
Expand Up @@ -66,7 +66,7 @@ def ties

# Relations defined and managed by this actor
def relations
Relation.includes(:ties) & Tie.sent_by(self)
Relation.includes(:ties).merge(Tie.sent_by(self))
end

# A given relation defined and managed by this actor
Expand All @@ -93,9 +93,9 @@ def actors(options = {})

case options[:direction]
when :senders
as = as.joins(:sent_ties) & Tie.received_by(self)
as = as.joins(:sent_ties).merge(Tie.received_by(self))
when :receivers
as = as.joins(:received_ties) & Tie.sent_by(self)
as = as.joins(:received_ties).merge(Tie.sent_by(self))
else
raise "actors in both directions is not supported yet"
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/tie.rb
Expand Up @@ -70,7 +70,7 @@ class Tie < ActiveRecord::Base

scope :following, lambda { |a|
where(:receiver_id => Actor.normalize_id(a)).
joins(:relation => :permissions) & Permission.follow
joins(:relation => :permissions).merge(Permission.follow)
}

validates_presence_of :sender_id, :receiver_id, :relation_id
Expand Down
4 changes: 2 additions & 2 deletions app/models/user.rb
Expand Up @@ -25,14 +25,14 @@ def age

def recent_groups
subjects(:subject_type => :group, :direction => :receivers) do |q|
q & Tie.recent
q.merge(Tie.recent)
end
end

# Subjects this user can acts as
def represented
subjects(:direction => :senders) do |q|
q.joins(:sent_ties => { :relation => :permissions }) & Permission.represent
q.joins(:sent_ties => { :relation => :permissions }).merge(Permission.represent)
end
end

Expand Down
4 changes: 2 additions & 2 deletions social_stream.gemspec
Expand Up @@ -19,13 +19,13 @@ Gem::Specification.new do |s|
s.add_runtime_dependency('jquery-rails', '~> 0.2.5')
s.add_runtime_dependency('cancan', '~> 1.5.1')
s.add_runtime_dependency('will_paginate', '~> 3.0.pre2')
s.add_development_dependency('rails', '~> 3.0.4')
s.add_development_dependency('rails', '~> 3.0.5')
s.add_development_dependency('capybara', '~> 0.3.9')
s.add_development_dependency('sqlite3-ruby')
if RUBY_VERSION < '1.9'
s.add_development_dependency('ruby-debug', '~> 0.10.3')
end
s.add_development_dependency('rspec-rails', '~> 2.4.1')
s.add_development_dependency('rspec-rails', '~> 2.5.0')
s.add_development_dependency('factory_girl', '~> 1.3.2')
s.add_development_dependency('forgery', '~> 0.3.6')
s.add_development_dependency('ci_reporter', '~> 1.6.4')
Expand Down

0 comments on commit 212f8c5

Please sign in to comment.