rare_map 2.0.3 → 2.1.0

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
  SHA1:
3
- metadata.gz: 2b42e9add88b2cc752f354b6f87f2f30763fd729
4
- data.tar.gz: 41998e37c66fa7f18608def180d6b90300bd356c
3
+ metadata.gz: 2f36cebebe2ae2b9d27341552d5932b21d27b2a7
4
+ data.tar.gz: d4b0f47a9a9f4e1706a677c26a40997161f5f07e
5
5
  SHA512:
6
- metadata.gz: 23bfd594a927457fd953cf7ec1afee71d40e255b2780331b86f7cde23c7c2097129704f0367bf352693c63889dab4a1ccaadf28fcd83dddf434610c061477ed0
7
- data.tar.gz: d97df7d53a08ad1ba86b7abafc5309e9059bdedd4a2a8c3aa257219a17b7819a7fa453944c80e0504a6d5ce3f9b1ed9456ff92be61b2ad32f6ec5e26d7edcec2
6
+ metadata.gz: ed2f064ca843bfa4455a5031ecfd31b6eaa2c3199af262c5723a21c76128ee3914d04016760076ed508b0eb82972848544cbb812d3e83e68a4ccb79bb38c756c
7
+ data.tar.gz: 94d9dc59f8a31ffe9edcffc10a57d661dc03a40066be797aba097c91d15a531fd48822b405823b7ec44a65fdde9d123a66993e95f21c1b9e30451b11d06bc992
@@ -18,34 +18,36 @@ module RareMap
18
18
  " self.table_name = '#{model.table.name}'\n" <<
19
19
  " self.inheritance_column = 'ruby_type'\n" <<
20
20
  " #{ "self.primary_key = '#{model.table.primary_key}'\n" if model.table.primary_key }\n" <<
21
- " attr_accessible #{model.table.columns.map { |col| ":#{col.name}" }.join(', ')}\n\n"
21
+ " if ActiveRecord::VERSION::STRING < '4.0.0'\n" <<
22
+ " attr_accessible #{model.table.columns.map { |col| ":#{col.name}" }.join(', ')}\n" <<
23
+ " end\n\n"
22
24
 
23
25
  belongs_to = model.relations.select { |rel| rel.type == :belongs_to }
24
26
  unless belongs_to.empty?
25
- output << belongs_to.
26
- map { |rel| " belongs_to :#{rel.table.pluralize.singularize}, :foreign_key => '#{rel.foreign_key}', :class_name => '#{classify_by_table(rel.table, model, models)}'" }.
27
- join("\n") << "\n"
27
+ output << belongs_to
28
+ .map { |rel| " belongs_to :#{rel.table.pluralize.singularize}, :foreign_key => '#{rel.foreign_key}', :class_name => '#{classify_by_table(rel.table, model, models)}'" }
29
+ .join("\n") << "\n"
28
30
  end
29
31
 
30
32
  has_one = model.relations.select { |rel| rel.type == :has_one }
31
33
  unless has_one.empty?
32
- output << has_one.
33
- map { |rel| " has_one :#{rel.table.pluralize.singularize}, :foreign_key => '#{rel.foreign_key}', :class_name => '#{classify_by_table(rel.table, model, models)}'" }.
34
- join("\n") << "\n"
34
+ output << has_one
35
+ .map { |rel| " has_one :#{rel.table.pluralize.singularize}, :foreign_key => '#{rel.foreign_key}', :class_name => '#{classify_by_table(rel.table, model, models)}'" }
36
+ .join("\n") << "\n"
35
37
  end
36
38
 
37
39
  has_many = model.relations.select { |rel| rel.type == :has_many }
38
40
  unless has_many.empty?
39
- output << has_many.
40
- map { |rel| " has_many :#{rel.table.pluralize}, :foreign_key => '#{rel.foreign_key}', :class_name => '#{classify_by_table(rel.table, model, models)}'" }.
41
- join("\n") << "\n"
41
+ output << has_many
42
+ .map { |rel| " has_many :#{rel.table.pluralize}, :foreign_key => '#{rel.foreign_key}', :class_name => '#{classify_by_table(rel.table, model, models)}'" }
43
+ .join("\n") << "\n"
42
44
  end
43
45
 
44
46
  has_many_through = model.relations.select { |rel| rel.type == :has_many_through }
45
47
  unless has_many_through.empty?
46
- output << has_many_through.
47
- map { |rel| " has_many :#{rel.table.pluralize}#{"_by_#{rel.through}, :source => :#{rel.table.pluralize.singularize}" if has_many_through.count { |hmt| hmt.table == rel.table } > 1 || has_many.count { |hm| hm.table == rel.table } > 0 }, :through => :#{rel.through.pluralize}, :foreign_key => '#{rel.foreign_key}', :class_name => '#{classify_by_table(rel.table, model, models)}'" }.
48
- join("\n") << "\n"
48
+ output << has_many_through
49
+ .map { |rel| " has_many :#{rel.table.pluralize}#{"_by_#{rel.through}, :source => :#{rel.table.pluralize.singularize}" if has_many_through.count { |hmt| hmt.table == rel.table } > 1 || has_many.count { |hm| hm.table == rel.table } > 0 }, :through => :#{rel.through.pluralize}, :foreign_key => '#{rel.foreign_key}', :class_name => '#{classify_by_table(rel.table, model, models)}'" }
50
+ .join("\n") << "\n"
49
51
  end
50
52
 
51
53
  output << " end\n"
@@ -1,7 +1,7 @@
1
1
  module RareMap
2
2
  module RailsLocator
3
3
  def locate_rails_root(depth = 5)
4
- rails_dirs = ['app', 'config', 'db', 'lib', 'log', 'public', 'script']
4
+ rails_dirs = ['app', 'config', 'db', 'lib', 'log', 'public']
5
5
 
6
6
  depth.times do |level|
7
7
  found = true
@@ -1,7 +1,7 @@
1
1
  module RareMap
2
2
  MAJOR = 2
3
- MINOR = 0
4
- PATCH = 3
3
+ MINOR = 1
4
+ PATCH = 0
5
5
 
6
6
  VERSION = [MAJOR, MINOR, PATCH].compact.join('.')
7
7
  end
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rare_map
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wei-Ming Wu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-16 00:00:00.000000000 Z
11
+ date: 2013-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: 3.2.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.2.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: 3.2.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: 3.2.0
41
41
  - !ruby/object:Gem::Dependency
@@ -137,10 +137,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
137
  version: '0'
138
138
  requirements: []
139
139
  rubyforge_project:
140
- rubygems_version: 2.0.5
140
+ rubygems_version: 2.0.6
141
141
  signing_key:
142
142
  specification_version: 4
143
- summary: rare_map-2.0.3
143
+ summary: rare_map-2.1.0
144
144
  test_files:
145
145
  - test/helper.rb
146
146
  - test/rare_map_test.rb