You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using Ruby on Rails 7 with multiple databases. I got this error.
I tried with:adapter: net_http but it isn't recognized.
Removing this line it doesn't raise exception but it doesn't connect to the secondary database.
How do I say to connect to the secondary database (ams) instead of primary ?
class ClickHouseRecord < ActiveRecord::Base
self.abstract_class = true
class << self
def agent
ClickHouse.connection
end
def insert(*argv, &block)
agent.insert(table_name, *argv, &block)
end
def select_one
agent.select_one(current_scope.to_sql)
end
def select_value
agent.select_value(current_scope.to_sql)
end
def select_all
agent.select_all(current_scope.to_sql)
end
def explain
agent.explain(current_scope.to_sql)
end
end
end
app/models/ams_record.rb
class AmsRecord < ClickHouseRecord
self.abstract_class = true
connects_to database: { writing: :ams, reading: :ams }
end
app/models/ams_traffic.rb
class AmsTraffic < AmsRecord
# This is my table on Click House
end
The text was updated successfully, but these errors were encountered:
leoplct
changed the title
database configuration does not specify adapter (ActiveRecord::AdapterNotSpecified)
Rails 7 - database configuration does not specify adapter (ActiveRecord::AdapterNotSpecified)
Nov 11, 2023
leoplct
changed the title
Rails 7 - database configuration does not specify adapter (ActiveRecord::AdapterNotSpecified)
Rails 7 - Database configuration does not specify adapter
Nov 11, 2023
I am using Ruby on Rails 7 with multiple databases. I got this error.
How do I say to connect to the secondary database (ams) instead of primary ?
app/models/ams_record.rb
connects_to database: { writing: :ams, reading: :ams }
/Users/name/.rvm/gems/ruby-3.1.2/gems/activerecord-7.0.8/lib/active_record/connection_adapters/abstract/connection_handler.rb:261:in `resolve_pool_config':
database configuration does not specify adapter (ActiveRecord::AdapterNotSpecified)
database.yml
app/models/click_house_record.rb
app/models/ams_record.rb
app/models/ams_traffic.rb
The text was updated successfully, but these errors were encountered: