Naming conflicts
This is the official documentation of the agent_ruby
Ruby agent.
Collection naming collisions
When importing collections to an admin panel, you may encounter naming collisions.
You can tackle them by renaming the collection that is causing issues.
There are two ways to rename collections: either provide a plain object which maps the old names to the new names, or a function which does the same.
Don't worry about leaving naming collisions: your development agent will warn you and crash at startup.
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: {
'customer' => 'customer_from_active_record',
'store' => 'store_from_active_record',
}
)
customize
@create_agent.build
end
def self.customize
# @create_agent.add_datasource....
end
end
end
Field naming collisions
You can tackle them by renaming the fields that are causing issues too.
Use the renameField method to change the name inside your forestadmin-schema.
Last updated
Was this helpful?