Ruby On Rails Cheat Sheet


Published on

Ruby On Rails Cheat Sheet

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Ruby On Rails Cheat Sheet

  1. 1. Methods DEFAULT DIRECTORY STRUCTURE PRE-DEFINED VARIABLES Arrays $! Exception information rails_root assoc $& String of last match app at $` String left of last match clear apis $' collect! String right of last match controllers compact! $+ Last group of last match application.rb concat $N Nth group of last match helpers delete $= Case insensitive flag delete_at application_helper.rb delete_if $/ Input record separator models Methods each $ Output record separator views each_index $, Output field separator Strings empty? layouts capitalize! eql? $. Current line number of components center fill last file read chomp! config first chop! $> Default output for print environments flatten! concat $_ Last input line of string count include? development.rb crypt index $0 Name of script production.rb delete! indexes $* Command line arguments downcase! test.rb join dump $stderr Standard error output last database.yml each length $stdin Standard input each_byte environment.rb nitems empty? $stdout Standard output routes.rb gsub! pack $-a True if -a is set. hash db pop hex $-d Status of -d switch push doc include? rassoc $-l True if -l is set index lib reject! intern $-p True if -p is set log replace length $-v Verbose Flag ljust, rjust reverse! development.log next! reverse_each production.log oct rindex replace RESERVED WORDS server.log shift reverse! slice! test.log rindex rescue =begin elsif sort! scan public uniq! retry =end end slice! images split unshift return BEGIN ensure squeeze! javascripts self END false strip! Validation controls.js sub! super alias for condition_block? sum dragdrop.js create! then and if swapcase! effects.js evaluate_condition tr! true begin in validate tr_s! prototype.js undef break module unpack validate_on_create stylesheets upcase! validate_on_update unless case next upto .htaccess validates_acceptance_of until class nil 404.html validates_associated Regex when def not validates_confirmation_of escape 500.html while defined? or validates_each last_match dispatch.cgi new validates_exclusion_of yield do redo quote dispatch.fcgi validates_format_of else casefold? validates_inclusion_of dispatch.rb kcode validates_length_of match favicon.ico validates_numericality_of source REGULAR EXPRESSIONS SYNTAX index.html validates_presence_of validates_size_of script Time ^ Start of string asctime validates_uniqueness_of test ctime $ End of string fixtures day Enumerable Mixin . Any single character gmt? functional collect gmtime (a|b) a or b each_with_index mocks hour (...) Group section entries isdst development localtime find [abc] Item in range (a or b or c) test mday find_all [^abc] Not in range (not a or b or c) min grep unit mon a? Zero or one of a include? test_helper.rb month max a* Zero or more of a sec vendor min strftime a+ One or more of a reject tv_sec a{3} Exactly 3 of a tv_usec sort usec METHODS NOTE a{3,} 3 or more of a utc Available free from a{3,6} Between 3 and 6 of a utc? ! - Denotes where a tailing ! may be wday !(pattern) quot;Notquot; prefix. Apply rule when ! - used. A colourless ! denotes that the yday URL does not match pattern. Ruby on Rails Logo year ! - ! is compulsory. zone used with permission.