diff --git a/README.md b/README.md index 98b8e44..563829a 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ $ gem install user_defined_fields ## Usage -#### Migrations +### Migrations To install the database table necessary to support user defined fields, use the following command: ```bash @@ -49,5 +49,31 @@ class AddUserDefinedFieldsToMyModel < ActiveRecord::Migration[7.0] end ``` +### Components + +User defined fields can be configured one of two ways: At the application level, or at the model level. + +##### Application Level +If configured at the application level, each record in the specified table will contain the same user defined fields. + +For example: You could define `first_name` and `last_name` fields for all of the `people` records. Anytime a user is editing a a person form, the `first_name` and `last_name` fields will be available as inputs. + +```jsx + +``` + +##### Model Level +If configured at the model level, records can contain different fields dependent on a parent record. + +For example: You could define a `location` field for `resources` that belong to Project A, then define a `project_stage` field for `resources` that belong to Project B. On the edit for for Project A, only the `location` field will be available. On the edit form for Project B, only the `project_stage` field will be available. + +```jsx + +``` + ## License The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).