When displaying changes, use '-' if id of associated object is blank

This commit is contained in:
Nishanth Vijayan 2016-08-20 15:45:53 +05:30
parent 75ee1371de
commit b30afccfba
2 changed files with 4 additions and 3 deletions

View file

@ -397,6 +397,7 @@ module ApplicationHelper
# Returns object in its current state if its alive
# Otherwise Returns object state just before deletion
def current_or_last_object_state(model_name, id)
return nil unless id.present? && model_name.present?
begin
object = model_name.constantize.find_by(id: id)
rescue NameError