Skip to content

Instantly share code, notes, and snippets.

Yuichiro Kaneko yui-knk

Block or report user

Report or block yui-knk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View compare_stackprof.rb
# stackprof (0.2.7)
require 'stackprof'
class StackProfTest
def test_raw
profile = StackProf.run(mode: :custom, raw: true) do
10.times do
StackProf.sample
end
View sample.md

rails adapter * tables * view

rails 4276b214f8a13a38ac7dc4911e90d295a8e40d5a

books is table, ebooks is view

class MigrationA < ActiveRecord::Migration
  def change
    create_table :books, force: true do |t|
@yui-knk
yui-knk / where_to_sql.rb
Last active Aug 29, 2015
Rails ActiveRecord where to_sql is changed (maybe broken....)
View where_to_sql.rb
# Rails 4.2.3 with mysql2
[1] pry(main)> User.where("id" => 1).to_sql
=> "SELECT `users`.* FROM `users` WHERE `users`.`id` = 1"
[2] pry(main)> User.where("users.id" => 1).to_sql
=> "SELECT `users`.* FROM `users` WHERE `users`.`id` = 1"
[3] pry(main)> User.where("db.users.id" => 1).to_sql
=> "SELECT `users`.* FROM `users` WHERE `db`.`users.id` = 1"
# [3] is invalid SQL because `db`.`users.id`
View gist:8486919
  • centos6.4

  • pry 0.9.12.4

  • rvm 1.25.8

  • ruby 1.9.3

[2] pry(main)> class Foo
View gist:8022158

env

  • windows XP
  • ruby 2.0.0
  • pry 0.9.11 ~ 0.9.12.4

constant Pry::REPL::Readline is undefined through pry_class.rb

    if defined?(Bond) && Readline::VERSION !~ /editline/i
      config.completer = Pry::BondCompleter.start
You can’t perform that action at this time.