Oh, you are right, update! works just fine. Datamapper really lacks for documentation :(
2010/7/7 Martin Gamsjaeger <[email protected]> > Yuri, > > I *think* that Model.all(:id => 0..5000).update(params) issues 5000 > queries because you're using the "safe" version of update() which > executes callbacks and validations. > > Model.all(:id => 0..5000).update!(params) > > Notice the bang (!) in update!(params). This will skip callbacks and > validations and should hopefully execute the queries you expect. Can > you confirm that? > > cheers > snusnu > > On Tue, Jul 6, 2010 at 20:02, Yuri Smirnov <[email protected]> wrote: > > Is there any way to make an update to the model using conditions? > > Model.update method always affects all rows in the database, so if i need > > for example to update some property for entries with id 0..5000 i have to > > use adapter.execute now. Model.all(:id => 0..5000).update(params) works > but > > it makes 5000 db queries instead of just one. So isn't this feature yet > > implemented or i just didn't find it? > > > > -- > > 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]<datamapper%[email protected]> > . > > For more options, visit this group at > > http://groups.google.com/group/datamapper?hl=en. > > > > -- > 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]<datamapper%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/datamapper?hl=en. > > -- 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.
