has_many
CREATE TABLE categories (
id bigserial NOT NULL PRIMARY KEY,
name text NOT NULL
)
CREATE TABLE posts (
id bigserial NOT NULL PRIMARY KEY,
name text NOT NULL,
content text,
category_id bigint NOT NULL
)class Post
include Clear::Model
primary_key
column name : String
column content : String?
belongs_to category : Category
end
class Category
include Clear::Model
primary_key
column name : String
has_many posts : Post
endCustomizing the relation
Adding to relation
Last updated