Veraticus/Dynamoid — pull request #18 by jasondew (2012-03-28 13:59:31+00:00)
Title: undefine previously generated methods before creating new ones

couldn't find a way to write a failing test for it but in my app the only dirty attribute methods that were getting generated were from id (not created_at, updated_at, etc).

Here's some IRB output from prior to the change:

```
1.9.3p125 :002 > class Foo; include Dynamoid::Document; field :created_at; end
nil
1.9.3p125 :003 > f = Foo.new
#nil, :created_at=>nil, :updated_at=>nil}>
1.9.3p125 :004 > f.methods.grep /change/
[
[0] changed() Foo (ActiveModel::Dirty)
[1] changed?() Foo (ActiveModel::Dirty)
[2] changed_attributes() Foo (ActiveModel::Dirty)
[3] changes() Foo (ActiveModel::Dirty)
[4] id_change(*args) Foo (
[5] id_changed?(*args) Foo (
[6] id_will_change!(*args) Foo (
[7] previous_changes() Foo (ActiveModel::Dirty)
]
```

and then after it:

```
1.9.3p125 :001 > class Foo; include Dynamoid::Document; field :created_at; end
true
1.9.3p125 :002 > f = Foo.new
#nil, :created_at=>nil, :updated_at=>nil}>
1.9.3p125 :003 > f.methods.grep /change/
[
[ 0] changed() Foo (ActiveModel::Dirty)
[ 1] changed?() Foo (ActiveModel::Dirty)
[ 2] changed_attributes() Foo (ActiveModel::Dirty)
[ 3] changes() Foo (ActiveModel::Dirty)
[ 4] created_at_change(*args) Foo (
[ 5] created_at_changed?(*args) Foo (
[ 6] created_at_will_change!(*args) Foo (
[ 7] id_change(*args) Foo (
[ 8] id_changed?(*args) Foo (
[ 9] id_will_change!(*args) Foo (
[10] previous_changes() Foo (ActiveModel::Dirty)
[11] updated_at_change(*args) Foo (
[12] updated_at_changed?(*args) Foo (
[13] updated_at_will_change!(*args) Foo (
]
```