When displaying changes, use '-' if id of associated object is blank
This commit is contained in:
parent
75ee1371de
commit
b30afccfba
2 changed files with 4 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue