Created
January 15, 2009 18:37
-
-
Save anonymous/47524 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# =========== | |
# odd, but Okay way to do it | |
opts = {:auto_validation => false} | |
opts_string = opts.merge({:size => 50}) | |
opts_decimal = opts.merge({:precision => 10, :scale => 4}) | |
property :firstname, String, opts_string | |
property :lastname, String, opts_string | |
property :minimum, BigDecimal, opts_decimal.merge({:nullable =>false}) | |
property :maximum, BigDecimal, opts_decimal | |
# =========== | |
# cleaner | |
opts = {:auto_validation => false, :size => 50} | |
property :firstname, String, opts | |
property :lastname, String, opts | |
opts = {:auto_validation => false, :precision => 10, :scale => 4} | |
property :minimum, BigDecimal, opts.merge({:nullable => false}) | |
property :maximum, BigDecimal, opts | |
# =========== | |
# more typing at first, but easier to maintain, more declarative, and more glance-able | |
# (Adam's preference) | |
property :firstname, String, :auto_validation => false, :size => 50 | |
property :lastname, String, :auto_validation => false, :size => 50 | |
property :minimum, BigDecimal, :auto_validation => false, :precision => 10, :scale => 4, :nullable => false | |
property :maximum, BigDecimal, :auto_validation => false, :precision => 10, :scale => 4 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment