rails-reverse-rename-column


/ Published in: Emacs Lisp
Save to your folder(s)



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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.