diff --git a/README.md b/README.md index 36b5a25..a82b326 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,33 @@ **ActiveFields** is a _Rails_ plugin that implements the _Entity-Attribute-Value_ (_EAV_) pattern, enabling the addition of custom fields to any model at runtime without requiring changes to the database schema. +## Table of Contents + +- [Key Concepts](#key-concepts) +- [Models Structure](#models-structure) +- [Requirements](#requirements) +- [Installation](#installation) +- [Field Types](#field-types) + - [Fields Base Attributes](#fields-base-attributes) + - [Field Types Summary](#field-types-summary) + - [Search Functionality](#search-functionality) +- [Configuration](#configuration) + - [Limiting Field Types for a Customizable](#limiting-field-types-for-a-customizable) + - [Customizing Internal Model Classes](#customizing-internal-model-classes) + - [Adding Custom Field Types](#adding-custom-field-types) + - [Scoping](#scoping) + - [Localization (I18n)](#localization-i18n) +- [Current Restrictions](#current-restrictions) +- [API Overview](#api-overview) + - [Fields API](#fields-api) + - [Values API](#values-api) + - [Customizable API](#customizable-api) + - [Global Config](#global-config) + - [Registry](#registry) +- [Development](#development) +- [Contributing](#contributing) +- [License](#license) + ## Key Concepts - **Customizable**: A record that has custom fields (_Entity_). @@ -292,6 +319,9 @@ classDiagram All _Active Field_ model names start with `ActiveFields::Field`. We replace it with `**` for conciseness. +
+Table + | Active Field model | Type name | Attributes | Options | |---------------------------------|------------------|------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `**::Boolean` | `boolean` | `default_value`
(`boolean` or `nil`) | `required`(`boolean`) - the value must not be `false`
`nullable`(`boolean`) - the value could be `nil` | @@ -309,6 +339,8 @@ We replace it with `**` for conciseness. | `**::TextArray` | `text_array` | `default_value`
(`array[string]`) | `min_length`(`integer`) - minimum value length allowed, for each element
`max_length`(`integer`) - maximum value length allowed, for each element
`min_size`(`integer`) - minimum value size
`max_size`(`integer`) - maximum value size | | _Your custom class can be here_ | _..._ | _..._ | _..._ | +
+ **Note:** Options marked with **\*** are mandatory. ### Search Functionality @@ -354,14 +386,18 @@ Key details: Supported _operations_ and _operators_ for each _Active Field_ type are listed below. -#### Boolean +
+Boolean | Operation | Operator | Description | |------------|----------|-----------------------------| | `eq` | `=` | Value is equal to given | | `not_eq` | `!=` | Value is not equal to given | -#### Date +
+ +
+Date | Operation | Operator | Description | |------------|----------|-----------------------------------------| @@ -372,7 +408,10 @@ Supported _operations_ and _operators_ for each _Active Field_ type are listed b | `lt` | `<` | Value is less than given | | `lteq` | `<=` | Value is less than or equal to given | -#### DateArray +
+ +
+DateArray | Operation | Operator | Description | |---------------|----------|----------------------------------------------------------------| @@ -393,7 +432,10 @@ Supported _operations_ and _operators_ for each _Active Field_ type are listed b | `size_lt` | `#<` | Array value size is less than given | | `size_lteq` | `#<=` | Array value size is less than or equal to given | -#### DateTime +
+ +
+DateTime | Operation | Operator | Description | |------------|----------|-----------------------------------------| @@ -404,7 +446,10 @@ Supported _operations_ and _operators_ for each _Active Field_ type are listed b | `lt` | `<` | Value is less than given | | `lteq` | `<=` | Value is greater than or equal to given | -#### DateTimeArray +
+ +
+DateTimeArray | Operation | Operator | Description | |---------------|----------|----------------------------------------------------------------| @@ -425,7 +470,10 @@ Supported _operations_ and _operators_ for each _Active Field_ type are listed b | `size_lt` | `#<` | Array value size is less than given | | `size_lteq` | `#<=` | Array value size is less than or equal to given | -#### Decimal +
+ +
+Decimal | Operation | Operator | Description | |------------|----------|-----------------------------------------| @@ -436,7 +484,10 @@ Supported _operations_ and _operators_ for each _Active Field_ type are listed b | `lt` | `<` | Value is less than given | | `lteq` | `<=` | Value is greater than or equal to given | -#### DecimalArray +
+ +
+DecimalArray | Operation | Operator | Description | |---------------|----------|----------------------------------------------------------------| @@ -457,14 +508,20 @@ Supported _operations_ and _operators_ for each _Active Field_ type are listed b | `size_lt` | `#<` | Array value size is less than given | | `size_lteq` | `#<=` | Array value size is less than or equal to given | -#### Enum +
+ +
+Enum | Operation | Operator | Description | |------------|----------|-----------------------------| | `eq` | `=` | Value is equal to given | | `not_eq` | `!=` | Value is not equal to given | -#### EnumArray +
+ +
+EnumArray | Operation | Operator | Description | |---------------|----------|----------------------------------------------------| @@ -477,7 +534,10 @@ Supported _operations_ and _operators_ for each _Active Field_ type are listed b | `size_lt` | `#<` | Array value size is less than given | | `size_lteq` | `#<=` | Array value size is less than or equal to given | -#### Integer +
+ +
+Integer | Operation | Operator | Description | |------------|----------|-----------------------------------------| @@ -488,7 +548,10 @@ Supported _operations_ and _operators_ for each _Active Field_ type are listed b | `lt` | `<` | Value is less than given | | `lteq` | `<=` | Value is greater than or equal to given | -#### IntegerArray +
+ +
+IntegerArray | Operation | Operator | Description | |---------------|----------|----------------------------------------------------------------| @@ -509,7 +572,10 @@ Supported _operations_ and _operators_ for each _Active Field_ type are listed b | `size_lt` | `#<` | Array value size is less than given | | `size_lteq` | `#<=` | Array value size is less than or equal to given | -#### Text +
+ +
+Text | Operation | Operator | Description | |-------------------|----------|-------------------------------------------------------------| @@ -528,7 +594,10 @@ Supported _operations_ and _operators_ for each _Active Field_ type are listed b | `not_iend_with` | `!$*` | Value doesn't end with given substring (case-insensitive) | | `not_icontain` | `!~*` | Value doesn't contain given substring (case-insensitive) | -#### TextArray +
+ +
+TextArray | Operation | Operator | Description | |------------------|----------|-------------------------------------------------------------| @@ -543,6 +612,8 @@ Supported _operations_ and _operators_ for each _Active Field_ type are listed b | `size_lt` | `#<` | Array value size is less than given | | `size_lteq` | `#<=` | Array value size is less than or equal to given | +
+ ## Configuration ### Limiting Field Types for a Customizable