On Sep 4, 2011, at 10:28 AM, TheDude wrote:
> 110% sure :) It's literally the first line after DataMapper.setup

Ah, but matters are not so simple as that. 

That `Model.update` call (eg., without a trailing '!') instantiates and then 
saves each resource, meaning that all callbacks and validations are run on each 
resource instance. By contrast, `Model.update!(:foo => 'bar')` does a mass 
update operating on the data in the data-store directly (eg., in SQL: `UPDATE 
table_name SET foo = bar`). 

Callbacks of any stripe might block `Model.update` (including validations). 
Check your model for a list of symbol and proc callbacks 
(`Model.hooks[:save][:before]`). You can also check if things work when 
skipping callbacks: `Model.all.each { |r| r.update!(updated_attributes) }`, 
which will instantiate each resource and confirm whether the update is being 
blocked by callbacks of some sort.

One other I have seen is that uncoercible data can cause silent failure 
(blocked by a false return value from `Property.valid?`). Try updating a 
different property or update your :energy property with a different value to 
get an idea of whether this might be occurring.

If none of the above gets you to a resolution, we may be able to help if you 
provide a simplified example that demonstrates the failure you are seeing.

Hope that helps,
Emmanuel

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to