Skip to content

Commit

Permalink
* Fix msg function. Now properly filtered.
Browse files Browse the repository at this point in the history
  • Loading branch information
LTe committed Aug 3, 2010
1 parent 1cfb62c commit c35e84b
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions lib/acts_as_messageable/acts-as-messageable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,25 @@ def msg(args = {})

all = self.recv + self.sent

if args[:from] != nil && args[:to] == nil
all.reject do |m|
if args[:from]
all.reject! do |m|
m.sent_messageable_id != args[:from].id
end
elsif args[:from] == nil && args[:to] != nil
all.reject do |m|
end

if args[:to]
all.reject! do |m|
m.received_messageable_id != args[:to].id
end
elsif args[:id] != nil
all.reject do |m|
end

if args[:id] != nil
all.reject! do |m|
m.id != args[:id]
end
else
all
end

all
end

def recv
Expand Down

0 comments on commit c35e84b

Please sign in to comment.