Skip to content

Update example in section "Configure Connection" in README.md #1241

@andsip

Description

@andsip

The following example code is proposed at the moment:

module ActiveRecord
  module ConnectionAdapters
    class SQLServerAdapter < AbstractAdapter
      def configure_connection
        super
        @raw_connection.execute("SET TEXTSIZE #{64.megabytes}").do
      end
    end
  end
end

However, as of commit 4842d2e, this implementation no longer works, as far as I see it.

This is because method #configure_connection was defined on SQLServerAdapter in that commit, which means that the example in the Readme will override this method, causing a call to super to invoke AbstractAdapter#configure_connection and not SQLServerAdapter#configure_connection (as intended).

The following adaptation of the example code works for me:

ActiveRecord::ConnectionAdapters::SQLServerAdapter.prepend(
  Module.new do
    def configure_connection
      super
      @raw_connection.execute("SET TEXTSIZE #{64.megabytes}").do
    end
  end
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions