reform-rails 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +4 -0
- data/database.sqlite3 +0 -0
- data/lib/reform/form/active_model.rb +0 -2
- data/lib/reform/rails/railtie.rb +57 -0
- data/lib/reform/rails/version.rb +1 -1
- data/lib/reform/rails.rb +1 -17
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1400de06d17da697f8c4a7e86191ed5a39b4c6dc
|
4
|
+
data.tar.gz: f64c23b9d6e57f89dcb5ab0fd5bba9cbe96163d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f6a025bb35d41901c746733b40f1979f579c60ac21d38cb49212a545b7a17905b2c4880bfd3b8a12fc2f2682950b032359193b932d4ce6ad81d1e70dfbcf3c4
|
7
|
+
data.tar.gz: 7429e04e455a6237f78019a41d04775ca4b2481c8ad5a9402979646c2b9472f1bd8d9a41e49fea3d63198316ce2bd026bc066a6c22ab2fdbea92bbe1b6a99419
|
data/CHANGES.md
CHANGED
data/database.sqlite3
CHANGED
Binary file
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module Reform
|
2
|
+
module Rails
|
3
|
+
class Railtie < ::Rails::Railtie
|
4
|
+
config.reform = ActiveSupport::OrderedOptions.new
|
5
|
+
|
6
|
+
initializer "reform.form_extensions", before: :load_config_initializers do
|
7
|
+
validations = config.reform.validations || :active_model
|
8
|
+
|
9
|
+
if validations == :active_model
|
10
|
+
active_model!
|
11
|
+
elsif validations == :dry
|
12
|
+
dry!
|
13
|
+
else
|
14
|
+
warn "[Reform::Rails] No validation backend set. Please do so via `config.reform.validations = :active_model`."
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def active_model!
|
19
|
+
require "reform"
|
20
|
+
require "reform/form/active_model/model_validations"
|
21
|
+
require "reform/form/active_model/form_builder_methods"
|
22
|
+
require "reform/form/active_model"
|
23
|
+
require "reform/form/active_model/validations"
|
24
|
+
require "reform/form/multi_parameter_attributes"
|
25
|
+
|
26
|
+
require "reform/active_record" if defined?(ActiveRecord)
|
27
|
+
require "reform/mongoid" if defined?(Mongoid)
|
28
|
+
|
29
|
+
Reform::Form.class_eval do
|
30
|
+
include Reform::Form::ActiveModel
|
31
|
+
include Reform::Form::ActiveModel::FormBuilderMethods
|
32
|
+
include Reform::Form::ActiveRecord if defined?(ActiveRecord)
|
33
|
+
include Reform::Form::Mongoid if defined?(Mongoid)
|
34
|
+
include Reform::Form::ActiveModel::Validations
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def dry!
|
39
|
+
require "reform"
|
40
|
+
require "reform/form/dry"
|
41
|
+
|
42
|
+
require "reform/form/multi_parameter_attributes"
|
43
|
+
require "reform/form/active_model/form_builder_methods" # this is for simple_form, etc.
|
44
|
+
|
45
|
+
# This adds Form#persisted? and all the other crap #form_for depends on. Grrrr.
|
46
|
+
require "reform/form/active_model" # DISCUSS: only when using simple_form.
|
47
|
+
|
48
|
+
Reform::Form.class_eval do
|
49
|
+
include Reform::Form::ActiveModel # DISCUSS: only when using simple_form.
|
50
|
+
include Reform::Form::ActiveModel::FormBuilderMethods
|
51
|
+
|
52
|
+
include Reform::Form::Dry
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end # Railtie
|
56
|
+
end
|
57
|
+
end
|
data/lib/reform/rails/version.rb
CHANGED
data/lib/reform/rails.rb
CHANGED
@@ -1,21 +1,5 @@
|
|
1
1
|
require "reform/rails/version"
|
2
|
-
|
3
|
-
require "reform"
|
4
|
-
require "reform/form/active_model"
|
5
|
-
require "reform/form/active_model/validations"
|
6
|
-
require "reform/form/multi_parameter_attributes"
|
7
|
-
|
8
|
-
|
9
|
-
require "reform/active_record" if defined?(ActiveRecord)
|
10
|
-
require "reform/mongoid" if defined?(Mongoid)
|
11
|
-
|
12
|
-
Reform::Form.class_eval do
|
13
|
-
include Reform::Form::ActiveModel
|
14
|
-
include Reform::Form::ActiveModel::FormBuilderMethods
|
15
|
-
include Reform::Form::ActiveRecord if defined?(ActiveRecord)
|
16
|
-
include Reform::Form::Mongoid if defined?(Mongoid)
|
17
|
-
include Reform::Form::ActiveModel::Validations
|
18
|
-
end
|
2
|
+
require "reform/rails/railtie"
|
19
3
|
|
20
4
|
module Reform
|
21
5
|
def self.rails3_0?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reform-rails
|
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
|
- Nick Sutterer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: reform
|
@@ -181,6 +181,7 @@ files:
|
|
181
181
|
- lib/reform/form/multi_parameter_attributes.rb
|
182
182
|
- lib/reform/form/validation/unique_validator.rb
|
183
183
|
- lib/reform/rails.rb
|
184
|
+
- lib/reform/rails/railtie.rb
|
184
185
|
- lib/reform/rails/version.rb
|
185
186
|
- reform-rails.gemspec
|
186
187
|
homepage: https://github.com/trailblazer/reform-rails
|