fix error

This commit is contained in:
chiu 2020-05-20 20:20:19 +08:00
parent a17980e7a7
commit 8342a17aca
2 changed files with 10 additions and 8 deletions

View File

@ -9,7 +9,6 @@
<% property = Property.where(id: @data['property_id']).first %> <% property = Property.where(id: @data['property_id']).first %>
<% if !property.nil? %> <% if !property.nil? %>
<h3><%= property['title'].collect{|k,v| v}.uniq.join('/') rescue nil %></h3> <h3><%= property['title'].collect{|k,v| v}.uniq.join('/') rescue nil %></h3>
<%= t('property_hire.editor') %>: <%= User.find(user_id).name rescue nil %>
<% I18n.with_locale(@data['locale']) do %> <% I18n.with_locale(@data['locale']) do %>
<table> <table>
<thead> <thead>
@ -19,14 +18,16 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<% ['property_usage','note','category','property_location','property_number','can_be_hired','purchase_date','owners','other_owner','owner_email','owner_phone','price'].each do |k| %> <% ['editor','property_usage','note','category','property_location','property_number','can_be_hired','purchase_date','owners','other_owner','owner_email','owner_phone','price'].each do |k| %>
<% v = property.send(k) %> <% v = property.send(k) rescue nil %>
<tr> <tr>
<td> <td>
<%= k=='category' ? t('category') : t("property_hire.#{k}") %>:&nbsp; <%= k=='category' ? t('category') : t("property_hire.#{k}") %>:&nbsp;
</td> </td>
<td> <td>
<% if ['purchase_date'].include?(k) %> <% if k == 'editor' %>
<%= User.find(user_id).name rescue nil %>
<% elsif ['purchase_date'].include?(k) %>
<%= v.strftime('%Y/%m/%d %H:%M') rescue nil %> <%= v.strftime('%Y/%m/%d %H:%M') rescue nil %>
<% elsif ['property_usage','note'].include?(k) %> <% elsif ['property_usage','note'].include?(k) %>
<%= property[k].collect{|k,v| v}.uniq.join('/') rescue nil %> <%= property[k].collect{|k,v| v}.uniq.join('/') rescue nil %>

View File

@ -8,7 +8,6 @@
<%= t('property_hire.email_edit_success') %> <%= t('property_hire.email_edit_success') %>
<% end %> <% end %>
<h3><%= property['title'].collect{|k,v| v}.uniq.join('/') rescue nil %></h3> <h3><%= property['title'].collect{|k,v| v}.uniq.join('/') rescue nil %></h3>
<%= t('property_hire.editor') %>: <%= User.find(user_id).name rescue nil %>
<% I18n.with_locale(@data['locale']) do %> <% I18n.with_locale(@data['locale']) do %>
<table> <table>
<thead> <thead>
@ -18,14 +17,16 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<% ['property_usage','note','category','property_location','property_number','can_be_hired','purchase_date','owners','other_owner','owner_email','owner_phone','price'].each do |k| %> <% ['editor','property_usage','note','category','property_location','property_number','can_be_hired','purchase_date','owners','other_owner','owner_email','owner_phone','price'].each do |k| %>
<% v = property.send(k) %> <% v = property.send(k) rescue nil %>
<tr> <tr>
<td> <td>
<%= k=='category' ? t('category') : t("property_hire.#{k}") %>:&nbsp; <%= k=='category' ? t('category') : t("property_hire.#{k}") %>:&nbsp;
</td> </td>
<td> <td>
<% if ['purchase_date'].include?(k) %> <% if k == 'editor' %>
<%= User.find(user_id).name rescue nil %>
<% elsif ['purchase_date'].include?(k) %>
<%= v.strftime('%Y/%m/%d %H:%M') rescue nil %> <%= v.strftime('%Y/%m/%d %H:%M') rescue nil %>
<% elsif ['property_usage','note'].include?(k) %> <% elsif ['property_usage','note'].include?(k) %>
<%= property[k].collect{|k,v| v}.uniq.join('/') rescue nil %> <%= property[k].collect{|k,v| v}.uniq.join('/') rescue nil %>