RubyMine Rails-specific Code Completion

Posted on by Eugene Toporov

And finally, the Rails! Rails is probably why most of us is using Ruby, right? So, RubyMine helps coding when Ruby on Rails is used.

Ruby on Rails Smartness #1

When a variable holds a model object RubyMine knows its type, its details and wisely offers the code completion.

And once you select first attribute to find_by you can try once again and RubyMine suggests again to create a complex find statement.

Ruby on Rails Smartness #2

Many Rails methods expect parameters of a certain kind or format. One example of such methods is validation methods (validate_uniqueness_of, validates_numericality_of, etc.).

RubyMine knows what should be in completion list after such methods, finds and suggests appropriate names.

Ruby on Rails Smartness #3

Quite often methods take hashes as parameters with only certain key values, ignoring the others.

[code=”ruby”]
class AdminController :index, :partial => ‘bye’
end

def index

end

end
[/code]

Some parameters of render hash in a controller are :partial, :action, :layout and :template.

When these are used the right part of the hash is clear.

For :partial it is partial view,

For :action — the action from the controller or its parent.

For other supported parameters check the documentation.

Subscribe

Subscribe for updates