ez_model 1.0.7 → 1.0.8

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.
@@ -1,3 +1,3 @@
1
1
  module EZModel
2
- VERSION = "1.0.7" unless defined?(::EZModel::VERSION)
2
+ VERSION = "1.0.8" unless defined?(::EZModel::VERSION)
3
3
  end
@@ -44,10 +44,10 @@ module Rmre
44
44
  def create_model(table_name)
45
45
  constraints = []
46
46
 
47
- foreign_keys.each do |fk|
48
- src = constraint_src(table_name, fk)
49
- constraints << src unless src.nil?
50
- end
47
+ #foreign_keys.each do |fk|
48
+ # src = constraint_src(table_name, fk)
49
+ # constraints << src unless src.nil?
50
+ #end
51
51
 
52
52
  _file_path = File.join(output_path, "#{table_name.tableize.singularize}.rb")
53
53
  if (!File.exists?(_file_path))
@@ -145,7 +145,7 @@ module Rmre
145
145
  def constraint_src(table_name, fk={})
146
146
  src = nil
147
147
  if fk['from_table'] == table_name
148
- src = "belongs_to :#{fk['to_table'].downcase}, :class_name => '#{fk['to_table'].tableize.classify}', :foreign_key => :#{fk['from_column']}"
148
+ src = "belongs_to :#{fk['to_table'].downcase.singularize}, :class_name => '#{fk['to_table'].tableize.classify}', :foreign_key => :#{fk['from_column']}"
149
149
  elsif fk['to_table'] == table_name
150
150
  src = "has_many :#{fk['from_table'].downcase.pluralize}, :class_name => '#{fk['from_table'].tableize.classify}'"
151
151
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ez_model
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-22 00:00:00.000000000 Z
12
+ date: 2012-06-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -110,9 +110,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
110
  version: '0'
111
111
  requirements: []
112
112
  rubyforge_project:
113
- rubygems_version: 1.8.22
113
+ rubygems_version: 1.8.24
114
114
  signing_key:
115
115
  specification_version: 3
116
116
  summary: Automatically generate model files from database.
117
117
  test_files: []
118
- has_rdoc: