Skip to content

Conversation

@jippeholwerda
Copy link

… how other adapters work.

This also allows you to execute stored procedures from a class without having to inherit from ActiveRecord::Base (for instance, because there is no table to map to):

class NoTableModel
  extend ActiveRecord::ConnectionHandling
  include ActiveRecord::Core

  self.configurations = Rails.configuration.database_configuration
  self.establish_connection("#{Rails.env}_some_database".to_sym)

  def self.execute_procedure(*args)
    self.connection_pool.with_connection { |conn| conn.execute_procedure(*args) }
  end
end

metaskills added a commit that referenced this pull request Dec 23, 2015
Use proper module for the sqlserver_connection method consistent with…
@metaskills metaskills merged commit 7570689 into rails-sqlserver:master Dec 23, 2015
metaskills added a commit that referenced this pull request Dec 23, 2015
@metaskills
Copy link
Member

Love it... this will be in the 4.2.7 soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants