app/models/type2.rb
# This stuff is before it jumps into timestamp.rb
This stuff is before it jumps into timestamp.rb
This stuff is before it jumps into timestamp . rb
def _update_record(attribute_names = self.attribute_names)
    if self.is_passthrough
      super(attribute_names)
    else
      old = self.class.where(id: self.id, dfrom: self.dfrom).first
      old.is_passthrough = true
      current_times = ActiveRecord::Base.connection.execute("SELECT NOW() - INTERVAL '1 microsecond' AS old, NOW() AS new;").first
      if self.attribute_names.include?("password_digest")
        ActiveRecord::Base.connection.execute("UPDATE users SET dto = '"+current_times["old"]+"' WHERE dfrom= '"+self.dfrom.utc.strftime("%Y-%m-%d %H:%M:%S.%6N")+"' AND id= " + self.id.to_s)
      else
        old.update(dto: current_times["old"].to_datetime)
      end
      new_one = self.dup
      new_one.id = self.id
      self.dfrom = new_one.dfrom = current_times["new"].to_datetime
      new_one.save
    end
  end
def _update_record ( attribute_names = self . attribute_names ) if self . is_passthrough super ( attribute_names ) else old = self . class . where ( id : self . id , dfrom : self . dfrom ) . first old . is_passthrough = true current_times = ActiveRecord :: Base . connection . execute ( "SELECT NOW() - INTERVAL '1 microsecond' AS old, NOW() AS new;" ) . first if self . attribute_names . include? ( "password_digest" ) ActiveRecord :: Base . connection . execute ( "UPDATE users SET dto = '" + current_times [ "old" ] + "' WHERE dfrom= '" + self . dfrom . utc . strftime ( "%Y-%m-%d %H:%M:%S.%6N" ) + "' AND id= " + self . id . to_s ) else old . update ( dto : current_times [ "old" ] . to_datetime ) end new_one = self . dup new_one . id = self . id self . dfrom = new_one . dfrom = current_times [ "new" ] . to_datetime new_one . save end end
This stuff is before it jumps into timestamp.rb
This stuff is before it jumps into timestamp . rb
# Cap the old one # %%% Lame way to do this, but users tables with bcrypt are some hell # Now INSERT the new version
attribute_names
<not_specific>