Closed 34code closed 8 years ago
Can you provide me a way to replicate that bug?
hmm -- I'm not sure its specific to my codebase.. would nobrainer and rethinkdb versions help?
Just provide me with a standalone ruby script that replicate that issue. Something along these lines:
require 'bundler'
Bundler.require
NoBrainer.configure do |c|
c.app_name = "issue220"
c.environment = "test"
c.logger = Logger.new(STDERR).tap { |l| l.level = Logger::DEBUG }
end
class User
include NoBrainer::Document
has_many :orders
end
class Order
include NoBrainer::Document
belongs_to :user
end
user = User.create!
user.orders... # run the thing
wait, I'm looking at the query again. it makes no sense. :order_id.include => "foo"
means that order_id
is an array containing a bunch of strings, and you want one of the string to be "foo". I think you meant :order_id => "foo"
in your query. If you want to use match
, you just use a regexp: where(:order_id => /foo/)
.
I get the following error when trying to use .include in the query..
original query:
heres the query nobrainer generates.
Cannot convert STRING to SEQUENCE Backtrace: r.table("orders").get_all( "usersuuid", {"index" => :user_id} ).filter {|var_189| r(["purchased", "ordered"]).contains(var_189[:buy_status]).and( var_189[:order_id].map {|var_190| var_190.eq("foo")}.contains(true) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) }.order_by(r.desc(:created_at)).skip(0).limit(7)