RubyMine Rails-specific Code Completion

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.

This entry was posted in Feature and tagged , , . Bookmark the permalink.

4 Responses to RubyMine Rails-specific Code Completion

  1. Nicholas F says:

    Hi,

    Just wondering if you guys can link to the forums from this blog – I keep landing back here from my RSS feed and want to click into the forums but can’t.

    Or am I missing the link?

    Regards,
    Nicholas F.

  2. Stefan says:

    This is hot stuff. As a never-satisfied customer have you considered adding rails documentation to the hash keys and valid options? Hop on the steroids, RubyMine!

  3. Oleg Shpynov says:

    Hello Stefan,

    Sounds great!
    I`ve create an issue on this: http://www.jetbrains.net/jira/browse/RUBY-2409

    Regards,
    Oleg

  4. @Nicholas F: A brilliant idea!
    I added the links to the sidebar.

    Thanks,
    -Eugene

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>