/ Published in: Emacs Lisp

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
(defun rails-reverse-rename-column () "In a rails migration, from point to end of buffer, reverse the order of renamed columns" (interactive) (save-excursion (while (re-search-forward "rename_column *\"\\([^\"]*\\)\" *, *\"\\([^\"]*\\)\" *, *\"\\([^\"]*\\)\" *$" nil t) (replace-match "rename_column \"\\1\", \"\\3\", \"\\2\""))))
Comments
