has_options 0.3.4 → 0.3.5

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.3.4
1
+ 0.3.5
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.3.4"
8
+ s.version = "0.3.5"
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"]
@@ -5,6 +5,10 @@ module HasOptionsHash
5
5
  end
6
6
 
7
7
  module ClassMethods
8
+ def acts_as_options
9
+ validates_presence_of :name, :association_type
10
+ end
11
+
8
12
  def has_options(options={})
9
13
  configuration = { :option_model => "Option", :association_name => :options}
10
14
  configuration.update(options) if options.is_a?(Hash)
@@ -14,7 +18,6 @@ module HasOptionsHash
14
18
  option_model = configuration[:option_model]
15
19
  table_name = option_model.constantize.table_name
16
20
  has_many association_name, :class_name => configuration[:option_model], :as => :entity, :dependent => :destroy, :conditions => {:association_type => association_name}
17
- validates_presence_of :name, :association_type
18
21
 
19
22
  class_eval <<-EOV
20
23
  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.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Stuart