Ruby on Rails IDE
Ruby would not have been so popular and so widely loved without such a powerful framework as Rails. RubyMine makes its best to enhance sustainable productivity of the framework and natively supports all major Ruby on Rails development practices. It offers a wide variety of assisting features that automate the whole process, making Rails development simpler and more effective, and RoR programmers more happy with the technologies they use.
RubyMine supports the Ruby on Rails framework from version 1.2 to the latest 3.2.x.
Model-View-Controller quick navigation and visualization options such as Rails structure view and model dependency diagram for more efficient navigation.
RubyMine takes into account RoR specifics for all productivity features such as smart code completion, code inspections and automatic refactorings.
RubyMine shares and multiplies the benefits of using Rails framework by not only supporting its tools but perfecting them.
Advanced Code Navigation
RUBY ON RAILS PROJECT VIEW
RubyMine can open an existing Rails project or automatically generate a Rails application skeleton for a new one.
The special 'Rails' project view shows the logical project structure displaying controllers, models, views, DB migrations, assets and so on, and providing quick access to these items and their contents such as controller methods, associated and partial views, etc.
ADVANCED PROJECT NAVIGATION
Smart navigation with one-click switching between models, views and controllers is available for Rails projects.
You can use the one-click active icons to quickly navigate around your application:
- Switch to view / partial view
- Switch to action
- Switch to controller
The intelligent 'Go to Related Files' option allows for quick navigation between appropriate Rails model, controller, view, helper, unit/functional/spec test from any location (Navigate | Go to Related Files, Ctrl+Alt+Home).
MODEL DEPENDENCY DIAGRAM
The Model Dependency diagram displays all project models with their attributes and associations. It allows taking an overview on project structure and navigating to the needed code.
You can quickly navigate from the diagram to a model or ssociation, and even do some refactoring.
You can also navigate from the diagram to the model's controller, views, helper or test using the 'Go to Related Files' option.
Intelligent Code Maintenance
In addition to intelligent code completion for Ruby language, RubyMine provides the following code completion features:
- Rails specific code completion for controllers, helpers, views.
- DB fields defined in migrations are recognized and shown in the completion lists.
- DB associations defined in models (has_one, has_many, etc.) are recognized and shown in the completion lists.
- Completion for find_by_* methods is supported.
- Completion specific for methods like url_for, redirect_to, etc.
- Completion and resolution of methods defined by named routes and resource routes.
To help you make code healthy, Rails-specific inspections are available in addition to the list of Ruby inspections. Inspired by Ruby on Rails Code Quality Checklist, they warn you about:
- wrong usages of model methods in a view, view helper or controller action,
- deprecated Rails features,
- i18n keys without corresponding locale records,
- unexpected parameter values of Rails-specific calls,
- and more.
In addition to generic Ruby refactorings, every code refactoring available in RubyMine is also aware of Ruby on Rails, helping you perform project-wide changes.
For example, for the Rename refactoring:
- renaming a model will also rename controller, helper, views and tests, and creates an appropriate migration;
- renaming a controller will also rename helper, views and tests;
- renaming an action method will rename corresponding view templates files, will update references to action method/view templates from rails calls such as render, redirect, etc. and will rename test file for action's view;
- a view template rename will also rename the corresponding action, references to action method/view templates and test file;
- view's test rename will only rename the test file.
There are also Rails-specific refactorings, e.g. 'Extract Partial' which allows you to move a part of a view file code to a separate partial view.
For adding new Rails entities such as models, controllers, scaffolds, etc. to your projects RubyMine provides quick and context sensitive access to Rails generators with a convenient UI.
RHTML, HAML & SLIM VIEWS EDITORS
RHTML layouts editing is fully supported together with:
- automatic code styling and formatting;
- braces, folding, syntax highlighting;
- smart code completion;
If you prefer developing HAML or Slim Rails views, you'll find:
- automatic code styling and formatting;
- syntax highlighting for the injected Ruby code;
- coding assistance for HTML code inside(completion, navigation, etc.).
RubyMine also provides:
- Controller-view navigation gutter for quickly switching between files.
- Context toolbar opening the page preview in a browser or in an embedded Web Preview.
- Setting breakpoints in RHTML and HAML files for debugging Ruby code.
- SCSS/LESS/SASS support and other web development features.
Rails Tools Perfected
RAILS INTERNATIONALIZATION (i18n)
RubyMine offers Rails i18n support with coding assistance for multi-language applications development.
Preparing your existing applications for a multi-language audience is a matter of executing a quick-fix on its string literals. Strings are auto-copied to a corresponding YML file and replaced with the Rails translate() method.
With RubyMine, you can also quickly navigate to property definitions, search for property keys usages and use the rename refactoring.
RubyMine supports syntax and error highlighting for YAML files and helps you comfortably edit internationalization property files (*.yml).
You can use the Rails console for whatever you're used to, by running it directly from the IDE. Just go to Run | Run Rails Console and select the environment.
The console provides syntax highlighting, commands history using Up/Down arrow buttons.
You can configure the console colors and fonts in Settings | Editor | Colors & Fonts.