Skip to content

Instantly share code, notes, and snippets.

@ignacy
Created October 25, 2012 07:42
Show Gist options
  • Select an option

  • Save ignacy/3951226 to your computer and use it in GitHub Desktop.

Select an option

Save ignacy/3951226 to your computer and use it in GitHub Desktop.
(defun get-candidate-by-email (email)
(comint-send-string (inf-ruby-proc)
(format "candidate = User.find_by_email('%s').try(:profile)" email)))
(defun get-your-candidate ()
(interactive)
(get-candidate-by-email "someemail@gmail.com"))
@tomekw

tomekw commented Oct 25, 2012

Copy link
Copy Markdown
(defun get-candidate-by-email (email)
  (comint-send-string (inf-ruby-proc)
  (format "candidate = User.by_email('%s').first.try(:profile)" email)))

(defun get-your-candidate ()
  (interactive)
  (get-candidate-by-email "someemail@gmail.com"))

Use by_email to use LOWER() index on email.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment