From 70f0e36bca217d26c12dcfa7c1534e1d9b1e6a2c Mon Sep 17 00:00:00 2001 From: Sergio Bayona Date: Wed, 21 Feb 2024 11:54:31 -0500 Subject: [PATCH] improved docs --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 4d8abc4..b07d82b 100644 --- a/README.md +++ b/README.md @@ -82,12 +82,17 @@ class User < ApplicationRecord model_description "A user of the system" property :name, description: "The user's name", title: "Full Name" property :group, enum: [1, 2, 3], default: 1, description: "The user's group" + virtual_property :age, type: "integer", description: "The user's age" end end ``` In the example above, the `enhance_schema` method is used to add a description to the model, change the title of the `name` property and add a description. It adds an enum, default value and a description to the `group` property. +Use the `property` keyword for the existing model attributes. In other words the symbol passed to the `property` method must be a column in the table that the model represents. Property does not accept a `type` argument, as the type is inferred from the column type. + +Use the `virtual_property` keyword for properties that are not columns in the table that the model represents.Virtual properties do accept a `type` argument, as the type cannot be inferred from the column type. + ## Development