Browse Source

Don't attempt to show a wheel size if it's blank

topic-sass
Jason Denney 11 years ago
parent
commit
ea79c167eb
  1. 7
      app/models/bike_wheel_size.rb

7
app/models/bike_wheel_size.rb

@ -2,7 +2,12 @@ class BikeWheelSize < ActiveRecord::Base
belongs_to :bike belongs_to :bike
def display_string def display_string
["#{twmm}-#{rdmm}", "#{rdin}x#{twin}", "#{rdfr}x#{twfr}", description].join(" | ") result = []
result << "#{twmm}-#{rdmm}" unless twmm.blank? and rdmm.blank?
result << "#{rdin}x#{twin}" unless rdin.blank? and twin.blank?
result << "#{rdfr}x#{twfr}" unless rdfr.blank? and twfr.blank?
result << description unless description.blank?
result.join(" | ")
end end
def to_s def to_s

Loading…
Cancel
Save