Ruby on Rails use of Ror.find_by_sql

  Kiến thức lập trình

I have inherited an app with the middle tier written in Ruby on Rails. (Not related to the question but I am in the process of upgrading to Ruby 3.2 and Rails 7.1.). The code makes heavy use of statements like the following:

class Security < ActiveRecord::Base
    def Security.GET_CURRENT_SESSION(params)
        rs=Ror.find_by_sql ["SELECT SECURITY_FUNCTIONS.GET_CURRENT_SESSION(?)", params.to_json ]
        return_string = rs[0].attributes["get_current_session"]
        return return_string
    end
end

Ruby-lint complains that Ror is an undefined constant, but the code works perfectly. I cannot find where Ror might be defined, so my question is is it some sort of shorthand for ActiveRecord? I’d like to be able to run ruby-lint over the code but I am getting hundreds of errors about Ror being undefined.

LEAVE A COMMENT