has_options 0.3.6 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/has_options.gemspec +2 -2
- data/lib/has_options/has_options.rb +3 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
data/has_options.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{has_options}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.4.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"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-03-01}
|
13
13
|
s.description = %q{Associates a hash of options wtih an ActiveRecord model}
|
14
14
|
s.email = %q{tastyhat@jamesstuart.org}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -19,6 +19,9 @@ module HasOptionsHash
|
|
19
19
|
table_name = option_model.constantize.table_name
|
20
20
|
has_many association_name, :class_name => configuration[:option_model], :as => :entity, :dependent => :destroy, :conditions => {:association_type => association_name}
|
21
21
|
|
22
|
+
accepts_nested_attributes_for association_name, :reject_if => lambda { |a| a[:name].blank? }, :allow_destroy => true
|
23
|
+
|
24
|
+
|
22
25
|
class_eval <<-EOV
|
23
26
|
define_method "find_#{singular_association}_value" do |name|
|
24
27
|
(opt = #{association_name}.find_by_name(name.to_s)) ? opt.value : nil
|
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.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Stuart
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-03-01 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|