dupe
dupe copied to clipboard
Dupe.define :address bugs out
When trying to define a dupe of 'address' it doesn't seem to be interpreting it correctly (maybe something to do with the pluralization parser?)
>> Dupe.define :address do |addr|
?> addr.name
>> addr.uniquify :address1
>> addr.address2
>> addr.city "Denver"
>> addr.region "CO"
>> addr.postal_code "55555"
>> addr.phone "5554443210"
>> addr.phone2
>> addr.fax
>> addr.main_address false
>> addr.addressable_id {Dupe.create(:profile).id}
>> addr.addressable_type "Profile"
>> addr.lat
>> addr.lng
>> end
>> Dupe.create(:address)
=> <#Duped::Addres id=1>
Notice how it's stripping one of the 's' characters off the end of the created object, and not reading in any of the default properties defined.
However, when I add an extra 's'... it decides to create the object properly.
>> Dupe.create(:addresss) # Notice the three 's' characters
=> <#Duped::Address lng=nil city="Denver" main_address=false region="CO" addressable_id=<#Duped::Profile id=1> postal_code="80234" name=nil phone="5554443210" address1="address 1 address1" addressable_type="Profile" phone2=nil lat=nil address2=nil id=1 fax=nil>
Same problem with 'Business'
ruby-1.9.2-p180 :069 > Dupe.create :business, :name => 'Test Name'
=> <#Duped::Busines id=1 name="Test Name">
ruby-1.9.2-p180 :072 > puts Dupe.network.log.pretty_print
Logged Requests:
Request: GET /businesses/1.json
Response:
<?xml version="1.0" encoding="UTF-8"?>
<busines>
<id type="integer">1</id>
</busines>