Welcome To Snipplr


Everyone's Recent Ruby Snippets Tagged ruby



1 2 3 4 5 ... 9
0 1283 posted 15 years ago by pdxmph
Easy way to populate a drop-down menu
3 2575 posted 15 years ago by chrisaiv
validate :price_must_be_at_least_a_cent protected def price_must_be_at_least_a_cent errors.add(:price, 'should be at least 0.01') if price.nil? || price < 0.01 end
0 1262 posted 15 years ago by stayce
0 1369 posted 15 years ago by inkdeep
0 1796 posted 15 years ago by inkdeep
0 1111 posted 15 years ago by inkdeep
0 1461 posted 15 years ago by inkdeep
0 1280 posted 15 years ago by sukantahazra
0 1248 posted 16 years ago by sai-venkat
Credit: http://pragmatig.wordpress.com/2009/04/14/recursive-symbolize_keys/
0 1315 posted 16 years ago by nate63179
Fetches an RSS feed and displays the title and summary of each entry. Nothing fancy.
0 1246 posted 16 years ago by PhilK
Simple example for using ActionMailer with Gmail (or other hosts if you remove the TLS settings).
0 1340 posted 16 years ago by PhilK
Don't forget to use require 'directory/name_of_class'
0 2159 posted 16 years ago by chrisaiv
1 1744 posted 16 years ago by endorfin
Ruby provides a platform independent way of displaying file paths. Here are a few common ways to show absolute and relative paths.
0 1562 posted 16 years ago by chrisaiv
This shows how we can find objects inside code blocks (aka data sets).
0 2101 posted 16 years ago by chrisaiv
1 1073 posted 16 years ago by shiftyjelly
Inserted at the top of the method body, this line creates instance variables for each of the method parameters and sets them to their respective argument values.
0 1677 posted 16 years ago by pmadden
The shell command which provides documentation for Ruby's classes and methods is:
0 1234 posted 16 years ago by deepsoul
A monkey patch splitting a string into sentences.
0 2008 posted 16 years ago by cocomo
1 2 3 4 5 ... 9