Sha256: c6c89e3fafb16531eda8681f824e567c6eed8f12eeee64e79919b0835db3f3ee

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

# TsSchema

Uses ActiveRecord to generate a schema.d.ts file for use in typescript frontends.

## Installation

```ruby
bundle add "ts_schema"
```

Then generate the initializer file:

```ruby
rails generate ts_schema:install
```

## Usage

All options with their defaults are in the generated initializer file.

By default, every migration will auto generate a new schema file, replacing the existing one. You can disable this behavior in the config file.

You can manually generate the schema file by running:

```ruby
rails ts_schema:generate
```

## Gotchas

Sometimes ActiveRecord's inflections will alter the class name. For instance, with a class named `Five`; `"Fives".singularize` returns "Fife", which is not the classname. In the case where Rails alters the classname for an association, you must explicitly define it on the association in the model using `class_name`. Example: `has_many :fives, class_name: "Five"`.

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ts_schema-0.1.13 README.md