User cert tweaks (handling nulls)
This commit is contained in:
parent
75e4907a9c
commit
a1ef8a5fd5
|
@ -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
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
<% @grouped_user_certs.sort.each do |cert, user_certifications| %>
|
||||
<dl class="collapsible">
|
||||
<dt><%= cert.name %></dt>
|
||||
<% user_certifications.sort{|a,b| a.user.name <=> b.user.name}.each do |user_certification| %>
|
||||
<% user_certifications.sort{|a,b| a.user_name <=> b.user_name}.each do |user_certification| %>
|
||||
<dd>
|
||||
<%= link_to user_certification.user.name, user_certification %>
|
||||
<%= link_to user_certification.user_name, user_certification %>
|
||||
</dd>
|
||||
<% end %>
|
||||
</dl>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<p>
|
||||
<b>User:</b>
|
||||
<%= @user_certification.user.name %>
|
||||
<%= @user_certification.user_name %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
@ -14,7 +14,12 @@
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b>Updated:</b> by <%= link_to @updated_by.name, @updated_by unless @updated_by.blank? %>
|
||||
<b>Updated:</b> by
|
||||
<% if @updated_by.blank? %>
|
||||
#<%= @user_certification.updated_by ||= "nil" %>
|
||||
<% else %>
|
||||
<%= link_to @updated_by.name, @updated_by %>
|
||||
<% end %>
|
||||
at <%= @user_certification.updated_at %>
|
||||
</p>
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user