diff --git a/app/models/user_certification.rb b/app/models/user_certification.rb index e29b17c..e1694c4 100644 --- a/app/models/user_certification.rb +++ b/app/models/user_certification.rb @@ -5,4 +5,12 @@ class UserCertification < ActiveRecord::Base belongs_to :user belongs_to :certification + + def user_name + if user.blank? + return "n/a (user ##{user_id} missing)" + else + return self.user.name + end + end end diff --git a/app/views/user_certifications/index.html.erb b/app/views/user_certifications/index.html.erb index 391f4fc..0ef5b64 100644 --- a/app/views/user_certifications/index.html.erb +++ b/app/views/user_certifications/index.html.erb @@ -5,9 +5,9 @@ <% @grouped_user_certs.sort.each do |cert, user_certifications| %>
User: - <%= @user_certification.user.name %> + <%= @user_certification.user_name %>
@@ -14,7 +14,12 @@
- Updated: by <%= link_to @updated_by.name, @updated_by unless @updated_by.blank? %> + Updated: by + <% if @updated_by.blank? %> + #<%= @user_certification.updated_by ||= "nil" %> + <% else %> + <%= link_to @updated_by.name, @updated_by %> + <% end %> at <%= @user_certification.updated_at %>