rails_templatable 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/models/rails_templatable/template.rb +3 -1
- data/lib/rails_templatable/version.rb +1 -1
- data/llms.txt +5 -4
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 236cee1ec2e19b223231cb8d60d18e125f2dabe88193c322243517b00b314c01
|
|
4
|
+
data.tar.gz: 0070d47ac23029648db250786fc3bc77205a74955d03ee19a98947c5ae7cbf51
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4be6f7c60f7b972796632fa6d56466e7fcdc69c9d229cc881e381e3d57fe57f8f5cbfd11fecbcad50b35ab545a2de3117399f90549fca53d12b5190fe85ae0e6
|
|
7
|
+
data.tar.gz: fd4ef91d412e0a7a579a7d7b7073729da7b12f6e3d01e6ccadc95ec4b1c341fe18e4e95e51e0c7d72affeff69c75e27dff5f41ff1e2093b6b4a25dd5e0b15561
|
|
@@ -2,7 +2,9 @@ module RailsTemplatable
|
|
|
2
2
|
class Template < ApplicationRecord
|
|
3
3
|
self.table_name = "rails_templatable_templates"
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
# Rails 6 compatible enum syntax
|
|
6
|
+
# For Rails 8+, use: enum :content_format, { html: 0, markdown: 1, txt: 2 }
|
|
7
|
+
enum content_format: { html: 0, markdown: 1, txt: 2 }
|
|
6
8
|
|
|
7
9
|
validates :category, presence: true
|
|
8
10
|
validates :content, presence: true
|
data/llms.txt
CHANGED
|
@@ -11,7 +11,7 @@ It provides a clean, namespace-isolated way to add template functionality to you
|
|
|
11
11
|
- No join table - uses direct foreign key `template_id` on target models
|
|
12
12
|
- Uses `category` instead of `type` to avoid Rails STI (Single Table Inheritance) conflicts
|
|
13
13
|
- Supports three content formats: HTML (0), Markdown (1), and TXT (2)
|
|
14
|
-
- The `content_format` field uses Rails enum
|
|
14
|
+
- The `content_format` field uses Rails enum (Rails 6 compatible: `enum content_format: { ... }`)
|
|
15
15
|
|
|
16
16
|
## Documentation
|
|
17
17
|
|
|
@@ -222,7 +222,7 @@ add_reference :posts, :template,
|
|
|
222
222
|
The engine supports three content formats via Rails enum:
|
|
223
223
|
|
|
224
224
|
```ruby
|
|
225
|
-
enum :
|
|
225
|
+
enum content_format: {
|
|
226
226
|
html: 0, # HTML content
|
|
227
227
|
markdown: 1, # Markdown content
|
|
228
228
|
txt: 2 # Plain text content (default)
|
|
@@ -371,12 +371,13 @@ To prevent any naming conflicts:
|
|
|
371
371
|
- **Custom fields require migration:** Add columns directly to tables if needed
|
|
372
372
|
- **`category` field is indexed:** Efficient queries by category
|
|
373
373
|
- **Default content_format is TXT:** New templates default to plain text (2)
|
|
374
|
-
- **Rails
|
|
374
|
+
- **Rails 6 enum syntax:** Uses `enum content_format: { ... }` for Rails 6+ compatibility
|
|
375
|
+
- **Rails 8+ upgrade note:** Can use `enum :content_format, { ... }` syntax when dropping Rails 6 support
|
|
375
376
|
|
|
376
377
|
## Development
|
|
377
378
|
|
|
378
379
|
- Rails Engine (non-mountable)
|
|
379
|
-
- Ruby
|
|
380
|
+
- Ruby 2.6+ required
|
|
380
381
|
- Rails 6.0+ compatible (tested on Rails 8.1.2)
|
|
381
382
|
- MIT License
|
|
382
383
|
- Author: aric.zheng <1290657123@qq.com>
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rails_templatable
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- aric.zheng
|
|
@@ -69,7 +69,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
69
69
|
requirements:
|
|
70
70
|
- - ">="
|
|
71
71
|
- !ruby/object:Gem::Version
|
|
72
|
-
version:
|
|
72
|
+
version: 2.6.0
|
|
73
73
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
74
|
requirements:
|
|
75
75
|
- - ">="
|