Skip to content

Commit

Permalink
nil check for owner and trackable
Browse files Browse the repository at this point in the history
  • Loading branch information
sbower committed Oct 14, 2011
1 parent 24b2e49 commit 5e062bf
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lib/public_activity/activity.rb
Expand Up @@ -42,12 +42,19 @@ class Activity < ActiveRecord::Base
def text(params = {})

#make all the fields of the owner and trackable object automatically avaialable
self.trackable.attributes.each do |key, value|
params[key.to_sym] = value

if !self.trackable.attributes.nil?
self.trackable.attributes.each do |key, value|
params[key.to_sym] = value
end
end
self.owner.attributes.each do |key, value|
params[key.to_sym] = value

if !self.owner.attributes.nil?
self.owner.attributes.each do |key, value|
params[key.to_sym] = value
end
end

parameters.merge! params

I18n.t(key, parameters || {})
Expand Down

0 comments on commit 5e062bf

Please sign in to comment.