brendan-entrails 1.0.5 → 1.0.6
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/entrails.gemspec +1 -1
- data/lib/entrails.rb +1 -1
- data/lib/entrails/active_record/find_by_association.rb +4 -2
- metadata +1 -1
data/entrails.gemspec
CHANGED
data/lib/entrails.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Entrails
|
2
|
-
VERSION='1.0.
|
2
|
+
VERSION='1.0.6'
|
3
3
|
AUTHORS=["Brendan Baldwin"]
|
4
4
|
EMAIL=["brendan@usergenic.com"]
|
5
5
|
DESCRIPTION=%q{This is a collection of extensions to Rails internals that I've found to be absolutely indispensible since I implimented them. The real action is happening in the following two files at the moment: http://github.com/brendan/entrails/tree/master/lib/entrails/active_record/better_conditions.rb http://github.com/brendan/entrails/tree/master/lib/entrails/active_record/find_by_association.rb}
|
@@ -162,8 +162,10 @@ module Entrails::ActiveRecord::FindByAssociation
|
|
162
162
|
match = /^find_(all_by|by)_([_a-zA-Z]\w*)$/.match(method_id.to_s)
|
163
163
|
match = /^find_or_(initialize|create)_by_([_a-zA-Z]\w*)$/.match(method_id.to_s) unless match
|
164
164
|
if match
|
165
|
-
|
166
|
-
|
165
|
+
action_type_segment = $1
|
166
|
+
attribute_names_segment = $2
|
167
|
+
action_type = (action_type_segment =~ /by/) ? :finder : :instantiator
|
168
|
+
attribute_names = attribute_names_segment.split(/_and_/)
|
167
169
|
options_argument = (arguments.size > attribute_names.size) ? arguments.last : {}
|
168
170
|
associations = {}
|
169
171
|
index = 0
|