Here is my code:
class UserTopicVisit < ActiveRecord::Base
belongs_to :user
belongs_to :topic
def self.log_last_user_topic_visit(user_id, topic_id)
visit = UserTopicVisit.find_or_create_by_user_id_and_topic_id(user_id, topic_id)
visit.update_attributes!(:last_visit => Time.now.to_formatted_s(:db))
end
end
Which is self-explainig.
The problems is: I need to be able to update object attribute without transaction, by simple mysql query. How can I accomplish that using activerecord?
Maybe you are looking for update-column