You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2014/03/13 00:22:38 UTC
[3/5] git commit: fix issue with find_by using exclamation point
fix issue with find_by using exclamation point
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/6ab616b0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/6ab616b0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/6ab616b0
Branch: refs/heads/usergrid-93
Commit: 6ab616b0c2a1d6743f1825b1b65a09bd0892e893
Parents: 746384c
Author: Scott Ganyo <sc...@ganyo.com>
Authored: Wed Mar 12 16:07:05 2014 -0700
Committer: Scott Ganyo <sc...@ganyo.com>
Committed: Wed Mar 12 16:07:05 2014 -0700
----------------------------------------------------------------------
sdks/ruby-on-rails/lib/usergrid_ironhorse/query.rb | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/6ab616b0/sdks/ruby-on-rails/lib/usergrid_ironhorse/query.rb
----------------------------------------------------------------------
diff --git a/sdks/ruby-on-rails/lib/usergrid_ironhorse/query.rb b/sdks/ruby-on-rails/lib/usergrid_ironhorse/query.rb
index 5945857..6868257 100644
--- a/sdks/ruby-on-rails/lib/usergrid_ironhorse/query.rb
+++ b/sdks/ruby-on-rails/lib/usergrid_ironhorse/query.rb
@@ -333,6 +333,12 @@ module Usergrid
def method_missing(method_name, *args)
method = method_name.to_s
+
+ if method.end_with? '!'
+ method.chop!
+ error_on_empty = true
+ end
+
if method.start_with? 'find_all_by_'
attribs = method.gsub /^find_all_by_/, ''
elsif method.start_with? 'find_by_'
@@ -350,11 +356,6 @@ module Usergrid
super
end
- if method.end_with? '!'
- method.chop!
- error_on_empty = true
- end
-
attribs = attribs.split '_and_'
conditions = {}
attribs.each { |attr| conditions[attr] = args.shift }
@@ -892,7 +893,7 @@ module Usergrid
return if loaded?
begin
@response = run_query
- @records = @response.entities.collect {|r| @model_class.model_name.constantize.new(r.data)}
+ @records = @response.entities.collect {|r| @model_class.model_name.constantize.new(r.data)}
rescue RestClient::ResourceNotFound
@records = []
end