anaf_habtm 0.0.96 → 0.0.97

Sign up to get free protection for your applications and to get access to all the features.
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.96"
8
+ s.version = "0.0.97"
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-15}
12
+ s.date = %q{2010-07-16}
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 = [
@@ -7,17 +7,18 @@ module AnafHabtm
7
7
  link_to(name, options={}, html_options={"href"=>"#", "class"=>"remove-child-link", :tabindex=> "0"})
8
8
  end
9
9
 
10
- def add_child_link(name, child, form_builder)
10
+ def add_child_link(name, child, form_builder, options={})
11
11
  # puts "||#{form_builder}||"
12
- new_form = new_child_fields(child, form_builder)
12
+ new_form = new_child_fields(child, form_builder, options)
13
13
  raw(content_tag(:div, new_form, {:id=>"#{child}_template", :class=>"form-template"}, escape=false))+
14
14
  link_to(name, options={}, html_options={"href"=>"#", "class"=>"add-child-link", "data-class-name"=>child})
15
15
  end
16
16
 
17
- def new_child_fields(child, form_builder)
17
+ def new_child_fields(child, form_builder, options={})
18
+ partial = options[:partial] ||= child.underscore
18
19
  output = ""
19
20
  form_builder.fields_for(child.pluralize.to_sym, child.camelize.constantize.new, :child_index => "__#{child}_id__") do |f|
20
- output += render(:partial => child.underscore, :locals => { :f => f })
21
+ output += render(:partial => partial, :locals => { :f => f })
21
22
  end
22
23
  output
23
24
  end
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: 223
4
+ hash: 221
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 96
10
- version: 0.0.96
9
+ - 97
10
+ version: 0.0.97
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-15 00:00:00 -07:00
18
+ date: 2010-07-16 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies: []
21
21