rails_core_extensions 0.13.0 → 0.13.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ccc0583ffb6264c6f3a3c4ec35caf8028c263dc37403eae6417a2e2a398b01c9
|
4
|
+
data.tar.gz: e332a69c6ed44ab4cec2f12608a0af873ab799d6f7274f818ab9c211eff05ee2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c73627135e3553892c98facf3071f2599db2f222d0c35e9b8fa9a0f372fa3f40dbdf10f42ccfc2d5df20fa37ae6136aba5199c98e8ef093f406989d16dd23443
|
7
|
+
data.tar.gz: 634791e2c66ab5972318a1a8f44c15ba00dd6257ae7110487c56ca2f9c8406dcf779c94558606242923ec626541486aa0bfe53913fb2cdc28cf3a9ba8422bdcd
|
data/CHANGELOG.md
CHANGED
@@ -1,30 +1,30 @@
|
|
1
1
|
module RailsCoreExtensions
|
2
2
|
module ActiveRecordLiquidExtensions
|
3
3
|
extend ActiveSupport::Concern
|
4
|
-
end
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
5
|
+
module ClassMethods
|
6
|
+
def validates_liquid(field)
|
7
|
+
field = field.to_sym
|
8
|
+
before_validation do |record|
|
9
|
+
begin
|
10
|
+
Liquid::Template.parse(record.send(field), error_mode: :strict)
|
11
|
+
rescue Liquid::SyntaxError => e
|
12
|
+
record.errors.add(field, "Liquid Syntax Error: #{e}")
|
13
|
+
end
|
14
14
|
end
|
15
15
|
end
|
16
|
-
end
|
17
16
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
17
|
+
def liquid_field(field)
|
18
|
+
class_eval <<-CODE
|
19
|
+
def parsed_#{field}
|
20
|
+
Liquid::Template.parse(#{field})
|
21
|
+
end
|
23
22
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
def render_#{field}(*args)
|
24
|
+
parsed_#{field}.render!(*args)
|
25
|
+
end
|
26
|
+
CODE
|
27
|
+
end
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_core_extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.13.
|
4
|
+
version: 0.13.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Noack
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-07-
|
12
|
+
date: 2022-07-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|