Naming conflicts
Collection naming collisions
module ForestAdminRails
class CreateAgent
def self.setup!
database_configuration = Rails.configuration.database_configuration
datasource = ForestAdminDatasourceActiveRecord::Datasource.new(database_configuration[Rails.env])
@create_agent = ForestAdminAgent::Builder::AgentFactory.instance.add_datasource(
datasource,
# Rename the `customers` and `stores` collections.
# Note that other collections won't be renamed.
rename: {
'customer' => 'customer_from_active_record',
'store' => 'store_from_active_record',
},
# Renaming collection can also be done by providing a proc or lambda.
# All collections will be renamed (the handler is called once per collection)
rename: proc { |name| name.upcase }
# rename: ->(name) { name.upcase }
)
customize
@create_agent.build
end
def self.customize
# @create_agent.add_datasource....
end
end
endField naming collisions
Last updated