anaf_habtm 0.0.93 → 0.0.94
Sign up to get free protection for your applications and to get access to all the features.
- data/anaf_habtm.gemspec +1 -1
- data/lib/anaf_habtm/anaf_active_record.rb +3 -3
- metadata +3 -3
data/anaf_habtm.gemspec
CHANGED
@@ -12,7 +12,7 @@ module AnafHabtm
|
|
12
12
|
|
13
13
|
# Needs to call scopes on a class and pass it values that are
|
14
14
|
# pulled from a hash called obj_attr
|
15
|
-
def make_scope_string(
|
15
|
+
def make_scope_string(find_opts)
|
16
16
|
_scopes = []
|
17
17
|
find_opts.each{ |scope, attr_name|
|
18
18
|
if attr_name.class == Hash
|
@@ -26,11 +26,11 @@ module AnafHabtm
|
|
26
26
|
|
27
27
|
def anaf_habtm(association, options={})
|
28
28
|
ar_opts = options[:ar_options] ||= {}
|
29
|
+
klass = ar_opts[:class_name] ||= association.singularize.camelize
|
29
30
|
class_eval do
|
30
31
|
has_and_belongs_to_many association.to_sym, ar_opts
|
31
32
|
end
|
32
|
-
find_line = "obj = obj ||= #{klass}.#{make_scope_string(
|
33
|
-
klass = association.to_s.singularize.camelize
|
33
|
+
find_line = "obj = obj ||= #{klass}.#{make_scope_string(find_opts[:find])}.first" if options.has_key?(:find)
|
34
34
|
association = association.to_s.underscore.tableize
|
35
35
|
scope_string =
|
36
36
|
class_eval <<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:
|
4
|
+
hash: 163
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 94
|
10
|
+
version: 0.0.94
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tyler Gannon
|