anaf_habtm 0.0.81 → 0.0.82

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rake'
2
2
  require 'rake/testtask'
3
3
  require 'rake/rdoctask'
4
4
 
5
- VERSION = "0.0.81"
5
+ VERSION = "0.0.82"
6
6
 
7
7
  desc 'Default: run unit tests.'
8
8
  task :default => :test
data/anaf_habtm.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{anaf_habtm}
8
- s.version = "0.0.81"
8
+ s.version = "0.0.82"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Tyler Gannon"]
12
- s.date = %q{2010-07-09}
12
+ s.date = %q{2010-07-11}
13
13
  s.description = %q{accepts_nested_attributes_for habtm}
14
14
  s.email = %q{t--g__a--nnon@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -26,11 +26,11 @@ module AnafHabtm
26
26
  end
27
27
  end
28
28
 
29
- def named_association(member, klass, attribute, create=nil)
29
+ def named_association(member, attribute, opts={})
30
30
  member = member.to_s
31
- klass = klass.name
31
+ klass = opts.has_key?(:class) ? opts[:class_name] : member.to_s.singularize.camelize
32
32
  attribute = attribute.to_s
33
- if create
33
+ if opts.has_key?(:create)
34
34
  class_eval "def #{member}_#{attribute}=(#{attribute});
35
35
  return if #{attribute}.blank?
36
36
  self.#{member} = #{klass}.find_or_create_by_#{attribute}(#{attribute})
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anaf_habtm
3
3
  version: !ruby/object:Gem::Version
4
- hash: 189
4
+ hash: 187
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 81
10
- version: 0.0.81
9
+ - 82
10
+ version: 0.0.82
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tyler Gannon
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-09 00:00:00 -07:00
18
+ date: 2010-07-11 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies: []
21
21