Flowdock

Notes posted by korin

RSS feed
June 16, 2011 - (>= v3.0.0)
1 thank

validating a database column acceptance

accept option should be set to true if you are validating a database column, since the attribute is typecast from “1” to true before validation

validates :terms,
  acceptance: {
    allow_nil: false,
    accept: true
  }
May 31, 2011 - (>= v3.0.0)
0 thanks

return random element

>> a = [1,2,3] >> a.sample 2

the same as

>> a[rand(a.length - 1)] 1