Skip to content
Browse files

nil check for owner and trackable

  • Loading branch information...
1 parent 24b2e49 commit 5e062bfe0c70f4915648d1f9bbf6604e2ac2fc32 sbower committed
Showing with 11 additions and 4 deletions.
  1. +11 −4 lib/public_activity/activity.rb
View
15 lib/public_activity/activity.rb
@@ -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 || {})

0 comments on commit 5e062bf

Please sign in to comment.
Something went wrong with that request. Please try again.