anaf_habtm 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -11,12 +11,14 @@ Hopefully this will fit snugly into someone else's gem
11
11
 
12
12
  * Install as a gem:
13
13
  # Add to your Gemfile
14
- gem "anaf_habtm", :git => "git://github.com/tylergannon/anaf_habtm.git"
14
+ gem "anaf_habtm"
15
15
  * or as a plugin
16
16
  rails plugin install git://github.com/tylergannon/anaf_habtm.git
17
- rake anaf_habtm:install # copies some javascript to public
18
-
19
-
17
+
18
+ Run the generator to place the javascript in the right place:
19
+
20
+ rails generate anaf_habtm
21
+
20
22
  Add the following to your layout:
21
23
  <%= javascript_include_tag 'nested_attributes.js' %>
22
24
 
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.7"
5
+ VERSION = "0.0.8"
6
6
 
7
7
  desc 'Default: run unit tests.'
8
8
  task :default => :test
data/anaf_habtm.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{anaf_habtm}
8
- s.version = "0.0.7"
8
+ s.version = "0.0.8"
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"]
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
21
21
  "Rakefile",
22
22
  "anaf_habtm.gemspec",
23
23
  "install.rb",
24
- "lib/active_record_extensions.rb",
24
+ "lib/anaf_active_record.rb",
25
25
  "lib/anaf_habtm.rb",
26
26
  "lib/application_helper_methods.rb",
27
27
  "lib/generators/anaf_habtm/anaf_habtm_generator.rb",
@@ -1,6 +1,5 @@
1
- # AnafHabtm
2
1
 
3
- module ActiveRecordExtensions
2
+ module AnafHabtm::ActiveRecord
4
3
  def anaf_habtm(association, options={}, &block)
5
4
  class_eval do
6
5
  # Define a proc that will look up the (potentially) existing object
@@ -17,7 +16,7 @@ module ActiveRecordExtensions
17
16
  attributes_for_association.each_value do |params|
18
17
  next if params["_destroy"] == "1"
19
18
  obj = finder.call(params["id"]) if params.has_key?("id")
20
- params.extend(HashExtension)
19
+ params.extend(AnafHabtm::HashExtension)
21
20
  # ActiveRecord::Base.attributes=() doesn't like extra parameters.
22
21
  coll << block.call(params.copy_without_destroy, obj)
23
22
  end
data/lib/anaf_habtm.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'hash'
2
- require 'active_record_extensions'
2
+ require 'anaf_active_record'
3
3
  require 'application_helper_methods'
4
- ActiveRecord::Base.extend(ActiveRecordExtensions)
5
- ActionView::Base.send :include, ApplicationHelperMethods
4
+ ActiveRecord::Base.extend(AnafHabtm::ActiveRecord)
5
+ ActionView::Base.send :include, AnafHabtm::ApplicationHelperMethods
6
6
 
@@ -1,4 +1,4 @@
1
- module ApplicationHelperMethods
1
+ module AnafHabtm::ApplicationHelperMethods
2
2
  def remove_child_link(name, form_builder)
3
3
  form_builder.hidden_field(:_destroy) + link_to_function(name, "remove_child(this)", :tabindex => "0")
4
4
  end
data/lib/hash.rb CHANGED
@@ -1,4 +1,4 @@
1
- module HashExtension
1
+ module AnafHabtm::HashExtension
2
2
  KEYS_TO_AVOID = ["_destroy", "id"]
3
3
  def copy_without_destroy
4
4
  a = {}
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: 17
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 7
10
- version: 0.0.7
9
+ - 8
10
+ version: 0.0.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tyler Gannon
@@ -33,7 +33,7 @@ files:
33
33
  - Rakefile
34
34
  - anaf_habtm.gemspec
35
35
  - install.rb
36
- - lib/active_record_extensions.rb
36
+ - lib/anaf_active_record.rb
37
37
  - lib/anaf_habtm.rb
38
38
  - lib/application_helper_methods.rb
39
39
  - lib/generators/anaf_habtm/anaf_habtm_generator.rb