added delivery costs to total / added ribica logo just for fun / added validation check when confirming delivery

This commit is contained in:
Senad Uka
2015-03-13 07:04:44 +01:00
parent e3abc09891
commit 648dee4636
17 changed files with 208 additions and 31 deletions

11
front-api/models/place.rb Normal file
View File

@@ -0,0 +1,11 @@
class Place < ActiveRecord::Base
def self.by_code_or_default(code)
# removes garbage and converts whitespace prefixed codes correctly - like " 71000" -> 71000
valid_code = code.to_i.to_s
place = Place.where(postal_code: valid_code).first
place ||= Place.where("postal_code is null or postal_code = ''").first
return place
end
end