habtm_generator 0.4 → 0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +4 -0
- data/habtm_generator.gemspec +1 -1
- data/lib/generators/habtm/habtm_generator.rb +3 -1
- data/test.rb +6 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e78010f2e839c96abb9e409c274e3226d15550df
|
4
|
+
data.tar.gz: 559f5ed4d68d74d34d810a5c1f80aca407b0d8d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ff90522b06dbcb446e5ab9ef63ab902dff78caab2ec51eee738a2306971c0669a8ff78febc67b4b16e416f3d146f2e524e67cf27eb22d4fa09af3127c6fb04b
|
7
|
+
data.tar.gz: af3bad16c38764a7faaf22eab24f8df04c2904e24d6873495b15225939ac5c2a9446afda134db56fb5d82bf5cb6439675381e9efa33c555073c81d331200d370
|
data/Rakefile
CHANGED
@@ -19,6 +19,10 @@ task :test => [:clear, 'dummy:app'] do
|
|
19
19
|
system 'rails g model admin/process'
|
20
20
|
system 'rails g habtm user post'
|
21
21
|
system 'rails g habtm user admin/process'
|
22
|
+
|
23
|
+
system 'rails g model chef_process'
|
24
|
+
system 'rails g model chef_script'
|
25
|
+
system 'rails g habtm chef_process chef_script'
|
22
26
|
system 'rake db:migrate'
|
23
27
|
system 'pwd'
|
24
28
|
system 'rails r ../../test.rb'
|
data/habtm_generator.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |gem|
|
|
12
12
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
13
13
|
gem.name = "habtm_generator"
|
14
14
|
gem.require_paths = ["lib"]
|
15
|
-
gem.version = "0.
|
15
|
+
gem.version = "0.5"
|
16
16
|
gem.add_dependency "activerecord"
|
17
17
|
gem.add_development_dependency 'appraisal'
|
18
18
|
gem.add_development_dependency 'pry'
|
@@ -51,7 +51,9 @@ class HabtmGenerator < ActiveRecord::Generators::Base
|
|
51
51
|
junction_string = '_'
|
52
52
|
end
|
53
53
|
|
54
|
-
sorted_models.map{|i| no_ns i.tableize}
|
54
|
+
pluralized = sorted_models.map{|i| no_ns i.tableize}
|
55
|
+
# stolen from active_record/associations/builder/has_and_belongs_to_many.rb
|
56
|
+
pluralized.join("\0").gsub(/^(.*[._])(.+)\0\1(.+)/, '\1\2_\3').tr("\0", junction_string)
|
55
57
|
end
|
56
58
|
|
57
59
|
def models
|
data/test.rb
CHANGED