Removed styles & removed after find call

This commit is contained in:
2019-11-12 12:36:25 -05:00
parent cdf2603e12
commit cab723bbcd
2 changed files with 4 additions and 6 deletions

View File

@@ -20,7 +20,7 @@ class Vehicle < ActiveRecord::Base
validates_presence_of :customer validates_presence_of :customer
validates :vin, uniqueness: true validates :vin, uniqueness: true
before_save :decode_vin before_save :decode_vin
after_find :get_details #after_find :get_details
self.primary_key = :id self.primary_key = :id
@@ -36,11 +36,13 @@ class Vehicle < ActiveRecord::Base
# returns the raw JSON details from EMUNDS # returns the raw JSON details from EMUNDS
def details def details
get_details if @details.nil?
return @details return @details
end end
# returns the style of the vehicle # returns the style of the vehicle
def style def style
get_details if @details.nil?
begin begin
return @details.trim if @details return @details.trim if @details
rescue rescue
@@ -57,6 +59,7 @@ class Vehicle < ActiveRecord::Base
# returns the number of doors of the vehicle # returns the number of doors of the vehicle
def doors def doors
get_details if @details.nil?
return @details.doors if @details return @details.doors if @details
end end

View File

@@ -16,11 +16,6 @@
<td><%= @vin[0] if @vin %><b><%=@vin[1] if @vin%></b></td> <td><%= @vin[0] if @vin %><b><%=@vin[1] if @vin%></b></td>
</tr> </tr>
<tr>
<th>Style</th>
<td><%= vehicle.style %></td>
</tr>
<tr> <tr>
<th>Notes</th> <th>Notes</th>
<td><%= vehicle.notes %></td> <td><%= vehicle.notes %></td>