probier das hier mal aus:

class Foo < ActiveRecord::Base
  self.record_timestamps = false
end

du müsstest mal schauen, dass du das halt nur in der methode setzt, die deine sortierung macht und nicht überall... gerade wenn es nur ne kleine methode ist und danach sonst nix mehr mit dem model gemacht wird, sollte das ziemlich einfach gehen...

in etwa so:

class Foo < ActiveRecord::Base

  def update_position(position)
    self.record_timestamps = false
    update_attribute(:position, position)
  end

end

gruß
manuel

Am 20.04.2009 um 00:25 schrieb Michael Schuerig:

On Monday 20 April 2009, Thomas Voigt wrote:
Als Workaround habe ich erstmal das hier gemacht:

temp_date = eintrag.updated_at
eintrag.save
sql = ActiveRecord::Base.connection();
sql.begin_db_transaction
sql.update "UPDATE `eintraege` SET `updated_at` =
'"+temp_date.to_s(:db)+"' WHERE `id` = "+eintrag.id.to_s
sql.commit_db_transaction

Also: ActiveRecord umgehen.

Vielleicht hat ja jemand einen Tipp, wie's schöner geht.

Du könntest auf den betroffenen Objekten

 obj.send(:changed_attributes).clear

aufrufen. Das sieht nur schöner aus, greift aber tief in die
Implementierung rein. Schau selbst in ActiveRecord::TimeStamp und
ActiveRecord::Dirty.

Michael

--
Michael Schuerig
mailto:[email protected]
http://www.schuerig.de/michael/

_______________________________________________
rubyonrails-ug mailing list
[email protected]
http://mailman.headflash.com/listinfo/rubyonrails-ug

_______________________________________________
rubyonrails-ug mailing list
[email protected]
http://mailman.headflash.com/listinfo/rubyonrails-ug

Antwort per Email an