dyna_form 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +54 -0
- data/LICENSE.txt +22 -0
- data/README.md +90 -0
- data/Rakefile +8 -0
- data/dyna_form.gemspec +27 -0
- data/lib/dyna_form/base.rb +97 -0
- data/lib/dyna_form/constants.rb +5 -0
- data/lib/dyna_form/submission.rb +33 -0
- data/lib/dyna_form/version.rb +3 -0
- data/lib/dyna_form.rb +5 -0
- data/spec/dyna_form/base_spec.rb +50 -0
- data/spec/dyna_form/submission_spec.rb +54 -0
- data/spec/spec_helper.rb +14 -0
- data/spec/support/admin_user.rb +3 -0
- data/spec/support/test_form.rb +4 -0
- data/spec/support/test_form_again.rb +4 -0
- metadata +141 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ebe2e3f52047f575f890cb82eac1285e34c80d6f
|
4
|
+
data.tar.gz: 307dd2232cbfda97c6ef3dbe723f57135b697a8a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ccbbb29668da0e8dae6fbeeed2522157d6193ae10935409a11f33c327a61689e32d4d8f68a353de4ac9c512f83e6d56e68c87cf97538010cb9ec45b65ced66c0
|
7
|
+
data.tar.gz: 00400aba310c964d9269fe2bb7bc6ca2359f26701c14406fece26fa7f4251fa569b088409d785aa649e2d2c35fe45961be114c46c152fd0d68a264820dcae8cd
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/.rspec
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
dyna_form (0.1.0)
|
5
|
+
activerecord
|
6
|
+
activesupport
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
activemodel (4.1.4)
|
12
|
+
activesupport (= 4.1.4)
|
13
|
+
builder (~> 3.1)
|
14
|
+
activerecord (4.1.4)
|
15
|
+
activemodel (= 4.1.4)
|
16
|
+
activesupport (= 4.1.4)
|
17
|
+
arel (~> 5.0.0)
|
18
|
+
activesupport (4.1.4)
|
19
|
+
i18n (~> 0.6, >= 0.6.9)
|
20
|
+
json (~> 1.7, >= 1.7.7)
|
21
|
+
minitest (~> 5.1)
|
22
|
+
thread_safe (~> 0.1)
|
23
|
+
tzinfo (~> 1.1)
|
24
|
+
arel (5.0.1.20140414130214)
|
25
|
+
builder (3.2.2)
|
26
|
+
diff-lcs (1.2.5)
|
27
|
+
i18n (0.6.11)
|
28
|
+
json (1.8.1)
|
29
|
+
minitest (5.4.0)
|
30
|
+
rake (10.3.2)
|
31
|
+
rspec (3.0.0)
|
32
|
+
rspec-core (~> 3.0.0)
|
33
|
+
rspec-expectations (~> 3.0.0)
|
34
|
+
rspec-mocks (~> 3.0.0)
|
35
|
+
rspec-core (3.0.3)
|
36
|
+
rspec-support (~> 3.0.0)
|
37
|
+
rspec-expectations (3.0.3)
|
38
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
39
|
+
rspec-support (~> 3.0.0)
|
40
|
+
rspec-mocks (3.0.3)
|
41
|
+
rspec-support (~> 3.0.0)
|
42
|
+
rspec-support (3.0.3)
|
43
|
+
thread_safe (0.3.4)
|
44
|
+
tzinfo (1.2.1)
|
45
|
+
thread_safe (~> 0.1)
|
46
|
+
|
47
|
+
PLATFORMS
|
48
|
+
ruby
|
49
|
+
|
50
|
+
DEPENDENCIES
|
51
|
+
bundler (~> 1.6)
|
52
|
+
dyna_form!
|
53
|
+
rake
|
54
|
+
rspec (~> 3.0.0)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Willux
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
# DynaForm
|
2
|
+
|
3
|
+
* Delegate all your forms to given models.
|
4
|
+
* Create multiple entries through a single form without a need for nesting.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
gem 'dyna_form'
|
11
|
+
|
12
|
+
And then execute:
|
13
|
+
|
14
|
+
$ bundle
|
15
|
+
|
16
|
+
Or install it yourself as:
|
17
|
+
|
18
|
+
$ gem install dyna_form
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
If you are using Ruby on Rails, I suggest you create a `app/forms` folder. This way you can keep your form submission functionality separate from the rest of the code.
|
23
|
+
|
24
|
+
Create a class that extends `DynaForm::Base`:
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
class TestForm < DynaForm::Base
|
28
|
+
# TODO: Put code here
|
29
|
+
end
|
30
|
+
```
|
31
|
+
|
32
|
+
Now suppose `:first_name` and `:last_name` belong in the `User` model, while
|
33
|
+
`address` belongs in the `Address` model. You can create a form in the following
|
34
|
+
way:
|
35
|
+
```ruby
|
36
|
+
form_for @user do |f|
|
37
|
+
f.input :first_name
|
38
|
+
f.input :last_name
|
39
|
+
f.fields_for :address do |a|
|
40
|
+
a.input :address
|
41
|
+
```
|
42
|
+
|
43
|
+
This is just a simple example. The form can get much more complicated and more
|
44
|
+
nested. **It can get really ugly really fast**
|
45
|
+
|
46
|
+
Now suppose we have our `TestForm` like so:
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
class TestForm < DynaForm::Base
|
50
|
+
submit :first_name, :last_name, to: User
|
51
|
+
submit :address, to: Address
|
52
|
+
end
|
53
|
+
```
|
54
|
+
|
55
|
+
In the controller you can create a form object to pass in to the view:
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
@test_form = TestForm.new
|
59
|
+
```
|
60
|
+
|
61
|
+
Then in your view you can use the object and create any fields you want:
|
62
|
+
```ruby
|
63
|
+
form_for @test_form do |f|
|
64
|
+
f.input :first_name
|
65
|
+
f.input :last_name
|
66
|
+
f.input :address
|
67
|
+
end
|
68
|
+
```
|
69
|
+
|
70
|
+
Once all the form values are passed, you can create the object with the params:
|
71
|
+
```ruby
|
72
|
+
@test_form = TestForm.new(params)
|
73
|
+
```
|
74
|
+
|
75
|
+
and submit it:
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
@test_form.submit!
|
79
|
+
```
|
80
|
+
|
81
|
+
`DynaForm#submit!` calls `ActiveRecord::Base#create!`. Which means that whatever
|
82
|
+
exception `ActiveRecord::Base#create!` throws, `DynaForm#submit!` will throw.
|
83
|
+
|
84
|
+
## Contributing
|
85
|
+
|
86
|
+
1. Fork it ( https://github.com/willux/dyna_form/fork )
|
87
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
88
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
89
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
90
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/dyna_form.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'dyna_form/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "dyna_form"
|
8
|
+
spec.version = DynaForm::VERSION
|
9
|
+
spec.authors = ["Willux"]
|
10
|
+
spec.email = ["zaikaus1@gmail.com"]
|
11
|
+
spec.summary = %q{A gem used to help delegate form fields to their respective models.}
|
12
|
+
spec.description = %q{We want to avoid nested forms while creating a form based on some object. This will help keep the forms clean while easily delegating each field into their models.}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency 'activerecord'
|
22
|
+
spec.add_dependency 'activesupport'
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
25
|
+
spec.add_development_dependency "rake"
|
26
|
+
spec.add_development_dependency "rspec", "~> 3.0.0"
|
27
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
module DynaForm
|
2
|
+
class Base
|
3
|
+
extend ActiveModel::Naming
|
4
|
+
extend DynaForm::Constants
|
5
|
+
|
6
|
+
include ActiveModel::Conversion
|
7
|
+
include ActiveModel::Validations
|
8
|
+
|
9
|
+
class << self
|
10
|
+
def submit(*args, hash)
|
11
|
+
updated_hsh = hash.with_indifferent_access
|
12
|
+
unless updated_hsh.length == SUBMIT_HASH_LIMIT && updated_hsh.has_key?(:to)
|
13
|
+
raise "Invalid parameter list."
|
14
|
+
end
|
15
|
+
|
16
|
+
raw_model = updated_hsh[:to].to_s
|
17
|
+
words = raw_model.split("_")
|
18
|
+
model_name = words.map { |w| w[0..0].capitalize + w[1..-1] }.join("")
|
19
|
+
|
20
|
+
fields = begin
|
21
|
+
class_variable_get(:@@fields)
|
22
|
+
rescue NameError
|
23
|
+
class_variable_set(:@@fields, {})
|
24
|
+
{}
|
25
|
+
end
|
26
|
+
|
27
|
+
fields[model_name] ||= []
|
28
|
+
fields[model_name] += args
|
29
|
+
class_variable_set(:@@fields, fields)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def initialize(args = {})
|
34
|
+
@lazy_initialization = (args == {})
|
35
|
+
args.each do |key, val|
|
36
|
+
create_var(key, val)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def method_missing(method, *arguments, &block)
|
41
|
+
@lazy_initialization ? create_var(method, arguments.first) : super
|
42
|
+
end
|
43
|
+
|
44
|
+
def submit!
|
45
|
+
submissions.each { |s| s.submit! }
|
46
|
+
end
|
47
|
+
|
48
|
+
def submit
|
49
|
+
submissions.each { |s| s.submit }
|
50
|
+
end
|
51
|
+
|
52
|
+
def persisted?
|
53
|
+
false
|
54
|
+
end
|
55
|
+
|
56
|
+
protected
|
57
|
+
|
58
|
+
def submissions
|
59
|
+
return @submissions unless @submissions.nil?
|
60
|
+
|
61
|
+
@submissions = []
|
62
|
+
|
63
|
+
# TODO: we might be able to change this to just @@fields. More testing
|
64
|
+
# will be required to ensure that that is the case.
|
65
|
+
fields = self.class.class_variable_get(:@@fields)
|
66
|
+
fields.each do |model, variables|
|
67
|
+
@submissions << DynaForm::Submission.new(model, variables, attributes)
|
68
|
+
end
|
69
|
+
@submissions
|
70
|
+
end
|
71
|
+
|
72
|
+
def attributes
|
73
|
+
return @attributes unless @attributes.nil?
|
74
|
+
|
75
|
+
@attributes = {}
|
76
|
+
instance_variables.each do |var|
|
77
|
+
attribute = var.to_s[1..-1].to_sym
|
78
|
+
@attributes[attribute] = instance_variable_get(var)
|
79
|
+
end
|
80
|
+
@attributes
|
81
|
+
end
|
82
|
+
|
83
|
+
def create_var(var_name, var_value)
|
84
|
+
updated_var_name = if var_name[-1, 1] == '='
|
85
|
+
var_name[0...-1]
|
86
|
+
else
|
87
|
+
var_name
|
88
|
+
end
|
89
|
+
|
90
|
+
self.instance_variable_set("@#{updated_var_name}", var_value)
|
91
|
+
|
92
|
+
self.class.instance_eval do
|
93
|
+
attr_accessor "#{updated_var_name}"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module DynaForm
|
2
|
+
class Submission
|
3
|
+
|
4
|
+
def initialize(model, variables, attributes)
|
5
|
+
@model = parse_model(model)
|
6
|
+
@variables = variables.map(&:to_sym)
|
7
|
+
@attributes = attributes.clone
|
8
|
+
end
|
9
|
+
|
10
|
+
def submit!
|
11
|
+
submit_helper(true)
|
12
|
+
end
|
13
|
+
|
14
|
+
def submit
|
15
|
+
submit_helper(false)
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def submit_helper(dangerous)
|
21
|
+
attrs = @attributes.select { |k, _| @variables.include?(k.to_sym) }
|
22
|
+
|
23
|
+
class_name = @model
|
24
|
+
dangerous ? Kernel.const_get(class_name).create!(attrs) : Kernel.const_get(class_name).create(attrs)
|
25
|
+
end
|
26
|
+
|
27
|
+
def parse_model(model)
|
28
|
+
str_model = model.to_s
|
29
|
+
words = str_model.split("_")
|
30
|
+
words.map { |w| w[0..0].capitalize + w[1..-1] }.join("")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/dyna_form.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe DynaForm::Base do
|
4
|
+
describe ".new" do
|
5
|
+
let(:base) { DynaForm::Base.new(var: "good", life: 42, "foo" => :bar)}
|
6
|
+
|
7
|
+
it "should create instance variables based on the arguments" do
|
8
|
+
expect(base.var).to eq("good")
|
9
|
+
expect(base.life).to eq(42)
|
10
|
+
expect(base.foo).to eq(:bar)
|
11
|
+
end
|
12
|
+
|
13
|
+
context "given that the argument hash is not empty" do
|
14
|
+
it "should not allow to initialize another instance variable" do
|
15
|
+
expect { base.new_var = "good" }.to raise_error(NoMethodError)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context "given that the argument has is empty" do
|
20
|
+
it "should allow to initialize any other instance variables" do
|
21
|
+
empty_base = DynaForm::Base.new
|
22
|
+
empty_base.new_var = :foo
|
23
|
+
empty_base.new_var_again = 42
|
24
|
+
|
25
|
+
expect(empty_base.new_var).to eq(:foo)
|
26
|
+
expect(empty_base.new_var_again).to eq(42)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe ".submit" do
|
32
|
+
it "should return the fields associated with a given class" do
|
33
|
+
fields = TestForm.class_variable_get(:@@fields)
|
34
|
+
expect(fields).to have_key("AdminUser")
|
35
|
+
expect(fields).to have_key("Nobody")
|
36
|
+
|
37
|
+
expect(fields["AdminUser"] - [:first_name, :last_name]).to eq([])
|
38
|
+
expect(fields["Nobody"] - [:who_cares]).to eq([])
|
39
|
+
end
|
40
|
+
|
41
|
+
context "given that the same model is used in different instances" do
|
42
|
+
it "should merge the fields of the same model" do
|
43
|
+
fields = TestFormAgain.class_variable_get(:@@fields)
|
44
|
+
expect(fields).to have_key("AdminUser")
|
45
|
+
|
46
|
+
expect(fields["AdminUser"] - [:middle_name, :nickname, :permissions, :awesomness]).to eq([])
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe DynaForm::Submission do
|
4
|
+
describe "#submit" do
|
5
|
+
let (:hypo_object) { OpenStruct.new }
|
6
|
+
let (:variables) { [:first_name, :last_name] }
|
7
|
+
let (:too_many_vars) { [:first_name, :last_name, :foo, :bar] }
|
8
|
+
let (:attributes) { { :first_name => "Who", :last_name => "Cares", :foo => 42 } }
|
9
|
+
|
10
|
+
context "given the model is in underscore style symbol" do
|
11
|
+
it "should be able to properly parse the model name" do
|
12
|
+
expect(Kernel).to receive(:const_get).with("AdminUser").and_raise("User created")
|
13
|
+
submission = DynaForm::Submission.new(:admin_user, variables, attributes)
|
14
|
+
expect { submission.submit }.to raise_error("User created")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context "given the model is in underscore style string" do
|
19
|
+
it "should be able to properly parse the model name" do
|
20
|
+
expect(Kernel).to receive(:const_get).with("AdminUser").and_raise("User created")
|
21
|
+
submission = DynaForm::Submission.new("admin_user", variables, attributes)
|
22
|
+
expect { submission.submit }.to raise_error("User created")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context "given the model is in camelcase style string" do
|
27
|
+
it "should be able to properly parse the model name" do
|
28
|
+
expect(Kernel).to receive(:const_get).with("AdminUser").and_raise("User created")
|
29
|
+
submission = DynaForm::Submission.new("adminUser", variables, attributes)
|
30
|
+
expect { submission.submit }.to raise_error("User created")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context "given the model is in upper camelcase style string" do
|
35
|
+
it "should be able to properly parse the model name" do
|
36
|
+
expect(Kernel).to receive(:const_get).with("AdminUser").and_raise("User created")
|
37
|
+
submission = DynaForm::Submission.new("AdminUser", variables, attributes)
|
38
|
+
expect { submission.submit }.to raise_error("User created")
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context "given the variables we want to save" do
|
43
|
+
it "should pick out the attributes based on the variable names" do
|
44
|
+
attrs = { :first_name => "Who", :last_name => "Cares" }
|
45
|
+
|
46
|
+
expect(Kernel).to receive(:const_get).with("AdminUser").and_return(hypo_object)
|
47
|
+
expect(hypo_object).to receive(:create).with(attrs).and_raise("User created")
|
48
|
+
|
49
|
+
submission = DynaForm::Submission.new(AdminUser, variables, attributes)
|
50
|
+
expect { submission.submit }.to raise_error("User created")
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
Bundler.setup
|
3
|
+
|
4
|
+
require 'active_support/all'
|
5
|
+
require 'dyna_form' # and any other gems you need
|
6
|
+
require 'support/admin_user'
|
7
|
+
require 'support/test_form'
|
8
|
+
require 'support/test_form_again'
|
9
|
+
require 'ostruct'
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
# some (optional) config here
|
13
|
+
# end
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dyna_form
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Willux
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activerecord
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.6'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.6'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 3.0.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 3.0.0
|
83
|
+
description: We want to avoid nested forms while creating a form based on some object.
|
84
|
+
This will help keep the forms clean while easily delegating each field into their
|
85
|
+
models.
|
86
|
+
email:
|
87
|
+
- zaikaus1@gmail.com
|
88
|
+
executables: []
|
89
|
+
extensions: []
|
90
|
+
extra_rdoc_files: []
|
91
|
+
files:
|
92
|
+
- ".gitignore"
|
93
|
+
- ".rspec"
|
94
|
+
- Gemfile
|
95
|
+
- Gemfile.lock
|
96
|
+
- LICENSE.txt
|
97
|
+
- README.md
|
98
|
+
- Rakefile
|
99
|
+
- dyna_form.gemspec
|
100
|
+
- lib/dyna_form.rb
|
101
|
+
- lib/dyna_form/base.rb
|
102
|
+
- lib/dyna_form/constants.rb
|
103
|
+
- lib/dyna_form/submission.rb
|
104
|
+
- lib/dyna_form/version.rb
|
105
|
+
- spec/dyna_form/base_spec.rb
|
106
|
+
- spec/dyna_form/submission_spec.rb
|
107
|
+
- spec/spec_helper.rb
|
108
|
+
- spec/support/admin_user.rb
|
109
|
+
- spec/support/test_form.rb
|
110
|
+
- spec/support/test_form_again.rb
|
111
|
+
homepage: ''
|
112
|
+
licenses:
|
113
|
+
- MIT
|
114
|
+
metadata: {}
|
115
|
+
post_install_message:
|
116
|
+
rdoc_options: []
|
117
|
+
require_paths:
|
118
|
+
- lib
|
119
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - ">="
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
requirements: []
|
130
|
+
rubyforge_project:
|
131
|
+
rubygems_version: 2.4.1
|
132
|
+
signing_key:
|
133
|
+
specification_version: 4
|
134
|
+
summary: A gem used to help delegate form fields to their respective models.
|
135
|
+
test_files:
|
136
|
+
- spec/dyna_form/base_spec.rb
|
137
|
+
- spec/dyna_form/submission_spec.rb
|
138
|
+
- spec/spec_helper.rb
|
139
|
+
- spec/support/admin_user.rb
|
140
|
+
- spec/support/test_form.rb
|
141
|
+
- spec/support/test_form_again.rb
|