This is the official documentation of the agent_ruby Ruby agent.
Customization refers to a series of actions that enable you to personalize your agent, data source, or collection.
An agent is an HTTP server that serves the Forest Admin front-end application. A data source is a database or an API that you want to connect to Forest Admin. A collection is a set of data that you want to manage in Forest Admin.
Among other things, you can modify your agent by incorporating data sources, using plugins, customizing collections, and adding charts. Additionally, you can personalize your data sources by offering choices that cater to all data source types. Lastly, you can adapt your collections by including actions, fields, relations, segments between the data sources and other functionalities.
module ForestAdminRails
class CreateAgent
include ForestAdmin::Types # Access all Forest Admin types
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)
# Use DSL for cleaner syntax
@create_agent.collection :task do |collection|
collection.computed_field :title, type: 'String', depends_on: [:name] do |records|
records.map { |record| record['name'].upcase }
end
end
@create_agent.build
end
end
end