anaf_habtm 0.0.7 → 0.0.8
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/README +6 -4
- data/Rakefile +1 -1
- data/anaf_habtm.gemspec +2 -2
- data/lib/{active_record_extensions.rb → anaf_active_record.rb} +2 -3
- data/lib/anaf_habtm.rb +3 -3
- data/lib/application_helper_methods.rb +1 -1
- data/lib/hash.rb +1 -1
- metadata +4 -4
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"
|
14
|
+
gem "anaf_habtm"
|
15
15
|
* or as a plugin
|
16
16
|
rails plugin install git://github.com/tylergannon/anaf_habtm.git
|
17
|
-
|
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
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.
|
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/
|
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
|
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 '
|
2
|
+
require 'anaf_active_record'
|
3
3
|
require 'application_helper_methods'
|
4
|
-
ActiveRecord::Base.extend(
|
5
|
-
ActionView::Base.send :include, ApplicationHelperMethods
|
4
|
+
ActiveRecord::Base.extend(AnafHabtm::ActiveRecord)
|
5
|
+
ActionView::Base.send :include, AnafHabtm::ApplicationHelperMethods
|
6
6
|
|
data/lib/hash.rb
CHANGED
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:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
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/
|
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
|