Created
January 25, 2016 16:02
-
-
Save stephaneerard/c5708c32b4b6b1260fad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def by_recipients(recipients) | |
@messages_query ||= db.prepare "SELECT id, sender, recipients, subject, size, created_at FROM message WHERE recipients LIKE ?" | |
@messages_query.execute("%#{recipients}%").map do |row| | |
Hash[row.fields.zip(row)].tap do |message| | |
message["recipients"] &&= ActiveSupport::JSON.decode message["recipients"] | |
end | |
end | |
end | |
=> | |
2016-01-25 15:54:35 - SQLite3::RangeException - bind or column index out of range: | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sqlite3-1.3.11/lib/sqlite3/statement.rb:41:in `bind_param' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sqlite3-1.3.11/lib/sqlite3/statement.rb:41:in `block in bind_params' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sqlite3-1.3.11/lib/sqlite3/statement.rb:37:in `each' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sqlite3-1.3.11/lib/sqlite3/statement.rb:37:in `bind_params' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sqlite3-1.3.11/lib/sqlite3/statement.rb:64:in `execute' | |
/q/p/continuous-integration/mailcatcher/i1/lib/mail_catcher/mail.rb:164:in `by_recipients' | |
/q/p/continuous-integration/mailcatcher/i1/lib/mail_catcher/web/application.rb:201:in `block in <class:Application>' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.7/lib/sinatra/base.rb:1610:in `call' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.7/lib/sinatra/base.rb:1610:in `block in compile!' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.7/lib/sinatra/base.rb:975:in `[]' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.7/lib/sinatra/base.rb:975:in `block (3 levels) in route!' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.7/lib/sinatra/base.rb:994:in `route_eval' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.7/lib/sinatra/base.rb:975:in `block (2 levels) in route!' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.7/lib/sinatra/base.rb:1015:in `block in process_route' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.7/lib/sinatra/base.rb:1013:in `catch' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.7/lib/sinatra/base.rb:1013:in `process_route' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.7/lib/sinatra/base.rb:973:in `block in route!' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.7/lib/sinatra/base.rb:972:in `each' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.7/lib/sinatra/base.rb:972:in `route!' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.7/lib/sinatra/base.rb:1085:in `block in dispatch!' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `block in invoke' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `catch' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `invoke' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.7/lib/sinatra/base.rb:1082:in `dispatch!' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.7/lib/sinatra/base.rb:907:in `block in call!' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `block in invoke' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `catch' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `invoke' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.7/lib/sinatra/base.rb:907:in `call!' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.7/lib/sinatra/base.rb:895:in `call' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in `call' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb:16:in `call' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/rack-protection-1.5.3/lib/rack/protection/json_csrf.rb:18:in `call' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb:31:in `call' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/rack-1.6.4/lib/rack/nulllogger.rb:9:in `call' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/rack-1.6.4/lib/rack/head.rb:13:in `call' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.7/lib/sinatra/base.rb:182:in `call' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.7/lib/sinatra/base.rb:2013:in `call' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.7/lib/sinatra/base.rb:1487:in `block in call' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.7/lib/sinatra/base.rb:1787:in `synchronize' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.7/lib/sinatra/base.rb:1487:in `call' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/rack-1.6.4/lib/rack/urlmap.rb:66:in `block in call' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/rack-1.6.4/lib/rack/urlmap.rb:50:in `each' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/rack-1.6.4/lib/rack/urlmap.rb:50:in `call' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/rack-1.6.4/lib/rack/builder.rb:153:in `call' | |
/q/p/continuous-integration/mailcatcher/i1/lib/mail_catcher/web.rb:19:in `call' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/thin-1.5.1/lib/thin/connection.rb:81:in `block in pre_process' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/thin-1.5.1/lib/thin/connection.rb:79:in `catch' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/thin-1.5.1/lib/thin/connection.rb:79:in `pre_process' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/thin-1.5.1/lib/thin/connection.rb:54:in `process' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/thin-1.5.1/lib/thin/connection.rb:39:in `receive_data' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/eventmachine-1.0.9.1/lib/eventmachine.rb:193:in `run_machine' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/eventmachine-1.0.9.1/lib/eventmachine.rb:193:in `run' | |
/q/p/continuous-integration/mailcatcher/i1/lib/mail_catcher.rb:153:in `run!' | |
/q/p/continuous-integration/mailcatcher/i1/bin/mailcatcher:5:in `<top (required)>' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/bin/mailcatcher:23:in `load' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/bin/mailcatcher:23:in `<main>' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/bin/ruby_executable_hooks:15:in `eval' | |
/usr/local/rvm/gems/ruby-1.9.3-p551/bin/ruby_executable_hooks:15:in `<main>' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment