Added some missing model specs + PaperTrail session fix

This commit is contained in:
Priit Tark 2015-02-02 18:09:01 +02:00
parent c248a957a6
commit a637eb5e01
39 changed files with 1447 additions and 845 deletions

View file

@ -1,5 +1,6 @@
class Address < ActiveRecord::Base
include Versions # version/address_version.rb
belongs_to :country_deprecated, foreign_key: :country_id
LOCAL_TYPE_SHORT = 'loc'
INTERNATIONAL_TYPE_SHORT = 'int'
@ -55,7 +56,7 @@ class Address < ActiveRecord::Base
def addr_hash_from_params(addr)
return {} if addr.nil?
return {} unless addr[:addr].is_a?(Hash)
{ country_code: Country.find_by(iso: addr[:addr][:cc]).try(:id),
{ country_code: Country.new(addr[:addr][:cc]).try(:alpha2),
city: addr[:addr][:city],
street: pretty_street(addr[:addr][:street]), # [0],
# street2: addr[:addr][:street][1],