It is minor mode for editing Ruby On Rails code with Emacs. This repo is a fork of remvee emacs-rails and adds the missing Rails 4 structure.
- Rails 4 ready
Implements new rails 4 directory structure: app/models, test/models etc. - Decorators
Include in Navigation and Running Tests - Navigation
Go from unit test to model to controller to functional test to view etc. - Running tests
Run test for the current model, controller, lib, decorator etc. - Console and webserver
Run this console and webserver in a buffer. - Rake tasks
Run rake tasks like rake db:migrate - Generations
Run rails generate scripts like rails generate model …
Try C-h b to find out what key bindings are available and see M-x customize-group <RET> rails for all the knobs and switches.
All below listed packages (except this minor-mode) can be installed via MELPA, ELPA or MARMELADE.
- Ruby Mode
- Inferior Ruby Mode
Pull the latest version from github:
git clone git://github.com/joe81/emacs-rails.git ~/.emacs.d/emacs-railsHook it up in your .emacs or .emacs.d/init.el with something like:
(add-to-list 'load-path (expand-file-name "~/.emacs.d/emacs-rails"))
(require 'rails)You’re ready to go.
- rhtml-mode
- yaml-mode
- ruby-electric
- company-mode or auto-complete
- robe
- flymake-ruby, flymake-coffee, flymake-json, flymake-yaml
- autopair-mode
- yasnippet-mode
- coffee-mode
As default this mode can be used for Rails 4 projects. If you want to use it for Rails 3 projects, checkout the rails-3.x branch or use the original repo from remvee/emacs-rails.git
C-c C-c g mgoto modelsC-c C-c g cgoto controllersC-c C-c g dgoto decoratorsC-c C-c g dgoto libsC-c C-c g hgoto helpersC-c C-c g ggoto migrationsC-c C-c g jgoto javascriptsC-c C-c g sgoto stylesheetsC-c C-c g lgoto layoutsC-c C-c g pgoto pluginsC-c C-c g ugoto model testsC-c C-c g fgoto controller testsC-c C-c g igoto integration testsC-c C-c g dgoto decorator testsC-c C-c g xgoto fixturesC-returngoto file on current line
Quick switch from Model to:
C-c cControllerC-c dDecoratorC-c uModelTestC-c xFixture
Quick switch from Controller to:
C-c mModelC-c hHelperC-c dDecoratorC-c fControllerTestC-upView of methodC-downSelect specific view
See context sensitive menus for other quick switchs.
C-c f mfind modelsC-c f cfind controllerC-c f hfind helpersC-c f lfind layoutC-c f sfind stylesheetsC-c f jfind javascriptsC-c f gfind migrateC-c f bfind libC-c f tfind tasksC-c f vfind viewC-c f dfind dbC-c f pfind publicC-c f ffind fixturesC-c f ofind configC-c f afind assets
C-c C-c y aStart all testsC-c C-c y uStart all model testsC-c C-c y fStart all controller testsC-c C-c y dStart all decorator testsC-c C-c y iStart all integration testsC-c C-c .Start all tests of current bufferC-c C-c ,Start current test of cursor postitionC-c /Toggle output window
C-c C-c kKill scriptC-c C-c eRails generateC-c C-c xRails destroyC-c C-c s cStart Rails consoleC-c C-c w sStart/Stop WebserverC-c C-c w iPrint Webserver statusC-c C-c w iAuto open BrowserC-c C-c s sStart SQL-BufferC-c M-ZStart terminal consoleC-c C-c C-tGenerate and update TAGS fileC-c C-c rStart rake tasks
C-c C-c d mRun migrationsC-c C-c d vMigrate to versionC-c C-c d vMigrate to previous versionC-c C-c d uMigrate version upC-c C-c d dMigrate version down
C-c pCreate partial from selectionC-c bCreate helper from blockC-c sSearch in project
A big thanks to Dmitry Galinsky for starting this project and Remco van ’t Veer and the other contributors who helped to push/enhance this project.