maeve/modelish — Issue #5: Undefined behavior when both keys for a translated property are present
Author: maeve
Created: 2012-02-15 19:07:30+00:00
State: open
Labels: bug

Given this modelish class:

```ruby
class Foo < Modelish:Base
property :my_property, :from => :my_original_prop
end
```

When both keys for for the translated property are present during initialization:

```ruby
model = Foo.new(:my_property => 'a', :my_original_property => 'b')
```

Then the current behavior is undefined. The actual value of `my_property` will be set based on whichever keypair in the initialization hash is processed last. The order in which keypairs are processed is dependent on hashie's internal implementation and the specific version of the ruby interpreter in use, and cannot be reliably predicted.

In the future, it would be nice (for a variety of reasons) if modelish imposed a predictable ordering of properties based on the order in which they were originally defined. However, this requires re-implementing some of the functionality that is currently borrowed from hashie.

In the meantime, modelish should probably raise an ArgumentError when this scenario occurs.