Ruby on-rails-cheat-sheet-v1


Published on

1 Like
  • Be the first to comment

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

No notes for slide

Ruby on-rails-cheat-sheet-v1

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