has_options 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
data/has_options.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{has_options}
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["James Stuart"]
@@ -11,8 +11,9 @@ module HasOptionsHash
11
11
 
12
12
  association_name = configuration[:association_name].to_s
13
13
  singular_association = association_name.singularize
14
-
15
- has_many association_name, :class_name => configuration[:option_model], :as => :entity, :dependent => :destroy
14
+ option_model = configuration[:option_model]
15
+ table_name = option_model.constantize.table_name
16
+ has_many association_name, :class_name => configuration[:option_model], :as => :entity, :dependent => :destroy, :conditions => {:association_type => association_name}
16
17
 
17
18
  class_eval <<-EOV
18
19
  define_method "find_#{singular_association}_value" do |name|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_options
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Stuart