Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query is not consistent -- sometimes get an error if I change the parameter #68

Open
angelacode opened this issue May 14, 2017 · 1 comment

Comments

@angelacode
Copy link

Issue

Please explain this issue you're encountering to the best of your ability.

Reproduction

[47] pry(#<BotResponse>)> e = Event.where.has {(keyword == 'daily_check') & (recurring == 'true') & (time_of_day == '8am')}
=> [#<Event:0x00000003f3eca8
  id: 15,
  bot_client_id: "aiaas-1409611358153-user-0147",
  keyword: "daily_check",
  topic: nil,
  status: "active",
  channel: "telegram",
  created_date: 2017-05-08 00:24:32 UTC,
  tickle_expression: "daily",
  time_of_day: "8am",
  next_occurrence: 2017-05-14 15:00:00 UTC,
  time_zone: nil,
  recurring: true>]
[48] pry(#<BotResponse>)> e.count
=> 1

[49] pry(#<BotResponse>)> e = Event.where.has {(bot_client_id == 'daily_check') & (recurring == 'true') & (time_of_day == '8am')}
=> #<Event::ActiveRecord_Relation:0x1ec6034>
[50] pry(#<BotResponse>)> e.count
RuntimeError: unsupported: FalseClass
from /usr/local/rvm/gems/ruby-2.2.1/gems/arel-6.0.4/lib/arel/visitors/to_sql.rb:736:in `unsupported'

I'm not sure why there should be a difference:

ActiveRecord::Schema.define do
	  unless ActiveRecord::Base.connection.tables.include? 'events'
	    create_table :events do |table|

	    	table.column :bot_client_id, 			:string

	    	table.column :keyword, 					:string
	    	table.column :topic, 					:string
	    	table.column :status, 					:string
	    	table.column :channel, 					:string

	    	table.column :created_date,             :datetime
	      	table.column :tickle_expression,        :string
	      	table.column :time_of_day,              :string
	      	table.column :next_occurrence,			:datetime
	      	table.column :time_zone,				:string
	      	table.column :recurring,				:boolean
	    end
	  end

	end
@rzane
Copy link
Owner

rzane commented Jun 12, 2017

@angelacode, I didn't see this issue! Sorry!

I'm not able to reproduce this issue. Could you fill out the issue template?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants