datamapper / dm-rails

Integrate DataMapper with Rails 3
http://datamapper.org/
MIT License
175 stars 39 forks source link

Rails flash doesn't save properly in dm-rails Session #17

Closed tpitale closed 12 years ago

tpitale commented 13 years ago

Flash in Rails doesn't work with the dm-rails session. The data property is never marked as dirty because the session data flash is modified as the same object.

mkristian commented 13 years ago

that is a known and common problem with DM, that complex types which you can directly and not through the setter are not marked dirty ! just for your info though it does not solve your problem ;-)

tpitale commented 13 years ago

True, it is a complex problem. I have a branch that uses the marshal/unmarshal trick to make a deep copy. This bug should not render dm-rails useless for session store. Alternatively, the session store could be removed.

Is for dm-core itself, the dirtiness should be magic. I shouldn't have to dig through the code. If I, the developer, know of an instance where the property is going to be dirty, I should be able to say so explicitly. That seems like the solution to me. Deep copying objects in order to make them dirty doesn't seem like much of a solution.

tpitale commented 12 years ago

It would seem that the dirtiness fixes elsewhere in DM have resolved this issue. I have removed my branch.