Skip to content

Commit

Permalink
fixed #notifiable_path
Browse files Browse the repository at this point in the history
#notifiable_path now calls super#notifiable_path if it exists
  • Loading branch information
upstill authored Nov 19, 2017
1 parent 8f6f0c3 commit 4a109d6
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/activity_notification/models/concerns/notifiable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,16 @@ def notifiable_path(target_type, key = nil)
nil,
key)
unless resolved_parameter
begin
resolved_parameter = polymorphic_path(self)
rescue NoMethodError, ActionController::UrlGenerationError
raise NotImplementedError, "You have to implement #{self.class}##{__method__}, "\
if defined?(super)
resolved_parameter = super
else
begin
resolved_parameter = defined?(super) ? super : polymorphic_path(self)
rescue NoMethodError, ActionController::UrlGenerationError
raise NotImplementedError, "You have to implement #{self.class}##{__method__}, "\
"set :notifiable_path in acts_as_notifiable or "\
"set polymorphic_path routing for #{self.class}"
end
end
end
resolved_parameter
Expand Down Expand Up @@ -398,4 +402,4 @@ def cast_to_resources_sym(target_type)
target_type.to_s.to_resources_name.to_sym
end
end
end
end

0 comments on commit 4a109d6

Please sign in to comment.