Skip to content

myovchev/rails-snippets

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rails-snippets package

An atom package to add snippets for Ruby on Rails projects.

Developed with Ruby 1.9 syntax (key: 'value') and rails 4 onwards in mind, but most code in the snippets is going to work on Rails 3 too.

Contributions are greatly appreciated, if your favorite snippets are missing open an issue or send a pull request, I would ❤️ to merge your favorite snippets.

Please fork this repository and open a pull request to add / improve snippets.

Features

  • Snippets with nice defaults that are definitely going to save your a lot of time.

  • Support for the great package by @eddorre:

    demo

Toggle with: cmd + >

(In american keyboard: shift + cmd + .)

Conventions

The conventions for the snippets are usually the initials for the method.

Examples:

  • For validates_presence_of is vpo
  • For has_and_belongs_to_many is habtm
  • For <%= link_to 'hi', path %> is lt and so on.

Also if the method has an optional block like content_tag (snippet is ct), its block it's going to be adding block to the shortcut, in this case ctblock

Snippets list

Here are some of my favorites snippets, a complete list of snippets can be seen directly at the code or once the package is installed at Settings > Packages > Rails Snippets

=loop

=loop_demo

form_for and fsf

=form_for fsf

scope + (p l bd j jp)

=form_for fsf

  • proc
  • lambda
  • bd Between dates
  • joins
  • jpjoins & proc

Packages

No packages published

Languages

  • CoffeeScript 100.0%