formgen 0.4.0 → 0.4.1

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.4.1
@@ -4,14 +4,14 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{formgen}
8
- s.version = "0.4.0"
7
+ s.name = "formgen"
8
+ s.version = "0.4.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Pullmonkey"]
12
- s.date = %q{2011-12-22}
13
- s.description = %q{Ruby on Rails form generator based on has_many and belongs_to associations. Includes the helpers and javascript for adding and removing fields_for form attributes.}
14
- s.email = %q{info@skizmo.com}
12
+ s.date = "2012-01-06"
13
+ s.description = "Ruby on Rails form generator based on has_many and belongs_to associations. Includes the helpers and javascript for adding and removing fields_for form attributes."
14
+ s.email = "info@skizmo.com"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
17
17
  "README.rdoc"
@@ -43,11 +43,11 @@ Gem::Specification.new do |s|
43
43
  "test/helper.rb",
44
44
  "test/test_formgen.rb"
45
45
  ]
46
- s.homepage = %q{http://github.com/pullmonkey/formgen}
46
+ s.homepage = "http://github.com/pullmonkey/formgen"
47
47
  s.licenses = ["MIT"]
48
48
  s.require_paths = ["lib"]
49
- s.rubygems_version = %q{1.4.2}
50
- s.summary = %q{Ruby on Rails form generator based on has_many and belongs_to associations}
49
+ s.rubygems_version = "1.8.10"
50
+ s.summary = "Ruby on Rails form generator based on has_many and belongs_to associations"
51
51
 
52
52
  if s.respond_to? :specification_version then
53
53
  s.specification_version = 3
@@ -117,11 +117,15 @@ module Skizmo
117
117
 
118
118
  def has_many_classes
119
119
  has_many_through_associations = class_reflections.select{|k,v| v.macro == :has_many and v.options.has_key?(:through)}
120
+ # "select" behaves differenly for different versions of ruby, so sometimes it works and returns a hash, other times, you get an array
121
+ has_many_through_associations = has_many_through_associations.to_a if has_many_through_associations.is_a?(Hash)
120
122
  through_assocs = has_many_through_associations.map{|x| x.last.options[:through]}
121
123
  # we don't care about the associations that primarily exist to assist the has_many :through
122
124
  has_many_associations = class_reflections.select{|k,v| v.macro == :has_many and
123
125
  not v.options.has_key?(:through) and
124
126
  not through_assocs.include?(k)}
127
+ # "select" behaves differenly for different versions of ruby, so sometimes it works and returns a hash, other times, you get an array
128
+ has_many_associations = has_many_associations.to_a if has_many_associations.is_a?(Hash)
125
129
  # these are the keys of the reflections we care about
126
130
  (has_many_through_associations | has_many_associations).map(&:first)
127
131
  end
@@ -136,7 +140,9 @@ module Skizmo
136
140
  end
137
141
 
138
142
  def belongs_to_classes
139
- class_reflections.select{|k,v| v.macro == :belongs_to}.map(&:first)
143
+ btcs = class_reflections.select{|k,v| v.macro == :belongs_to}
144
+ btcs = btcs.to_a if btcs.is_a?(Hash)
145
+ btcs.map(&:first)
140
146
  end
141
147
 
142
148
  # only get the classes that have "nested attributes"
metadata CHANGED
@@ -1,93 +1,69 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: formgen
3
- version: !ruby/object:Gem::Version
4
- hash: 15
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.1
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 4
9
- - 0
10
- version: 0.4.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Pullmonkey
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-12-22 00:00:00 -07:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- type: :development
23
- version_requirements: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
- version: "0"
32
- requirement: *id001
33
- prerelease: false
12
+ date: 2012-01-06 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
34
15
  name: shoulda
35
- - !ruby/object:Gem::Dependency
16
+ requirement: &78936480 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
36
22
  type: :development
37
- version_requirements: &id002 !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ version_requirements: *78936480
25
+ - !ruby/object:Gem::Dependency
26
+ name: bundler
27
+ requirement: &78921400 !ruby/object:Gem::Requirement
38
28
  none: false
39
- requirements:
29
+ requirements:
40
30
  - - ~>
41
- - !ruby/object:Gem::Version
42
- hash: 23
43
- segments:
44
- - 1
45
- - 0
46
- - 0
31
+ - !ruby/object:Gem::Version
47
32
  version: 1.0.0
48
- requirement: *id002
49
- prerelease: false
50
- name: bundler
51
- - !ruby/object:Gem::Dependency
52
33
  type: :development
53
- version_requirements: &id003 !ruby/object:Gem::Requirement
34
+ prerelease: false
35
+ version_requirements: *78921400
36
+ - !ruby/object:Gem::Dependency
37
+ name: jeweler
38
+ requirement: &78921080 !ruby/object:Gem::Requirement
54
39
  none: false
55
- requirements:
40
+ requirements:
56
41
  - - ~>
57
- - !ruby/object:Gem::Version
58
- hash: 7
59
- segments:
60
- - 1
61
- - 6
62
- - 4
42
+ - !ruby/object:Gem::Version
63
43
  version: 1.6.4
64
- requirement: *id003
65
- prerelease: false
66
- name: jeweler
67
- - !ruby/object:Gem::Dependency
68
44
  type: :development
69
- version_requirements: &id004 !ruby/object:Gem::Requirement
70
- none: false
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- hash: 3
75
- segments:
76
- - 0
77
- version: "0"
78
- requirement: *id004
79
45
  prerelease: false
46
+ version_requirements: *78921080
47
+ - !ruby/object:Gem::Dependency
80
48
  name: rcov
81
- description: Ruby on Rails form generator based on has_many and belongs_to associations. Includes the helpers and javascript for adding and removing fields_for form attributes.
49
+ requirement: &78920810 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *78920810
58
+ description: Ruby on Rails form generator based on has_many and belongs_to associations. Includes
59
+ the helpers and javascript for adding and removing fields_for form attributes.
82
60
  email: info@skizmo.com
83
61
  executables: []
84
-
85
62
  extensions: []
86
-
87
- extra_rdoc_files:
63
+ extra_rdoc_files:
88
64
  - LICENSE.txt
89
65
  - README.rdoc
90
- files:
66
+ files:
91
67
  - .document
92
68
  - Gemfile
93
69
  - Gemfile.lock
@@ -113,39 +89,32 @@ files:
113
89
  - lib/generators/skizmo/form/templates/setup_helper.rb
114
90
  - test/helper.rb
115
91
  - test/test_formgen.rb
116
- has_rdoc: true
117
92
  homepage: http://github.com/pullmonkey/formgen
118
- licenses:
93
+ licenses:
119
94
  - MIT
120
95
  post_install_message:
121
96
  rdoc_options: []
122
-
123
- require_paths:
97
+ require_paths:
124
98
  - lib
125
- required_ruby_version: !ruby/object:Gem::Requirement
99
+ required_ruby_version: !ruby/object:Gem::Requirement
126
100
  none: false
127
- requirements:
128
- - - ">="
129
- - !ruby/object:Gem::Version
130
- hash: 3
131
- segments:
101
+ requirements:
102
+ - - ! '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ segments:
132
106
  - 0
133
- version: "0"
134
- required_rubygems_version: !ruby/object:Gem::Requirement
107
+ hash: -286078481
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
135
109
  none: false
136
- requirements:
137
- - - ">="
138
- - !ruby/object:Gem::Version
139
- hash: 3
140
- segments:
141
- - 0
142
- version: "0"
110
+ requirements:
111
+ - - ! '>='
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
143
114
  requirements: []
144
-
145
115
  rubyforge_project:
146
- rubygems_version: 1.4.2
116
+ rubygems_version: 1.8.10
147
117
  signing_key:
148
118
  specification_version: 3
149
119
  summary: Ruby on Rails form generator based on has_many and belongs_to associations
150
120
  test_files: []
151
-