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

View File

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