Instantly share code, notes, and snippets.

What would you like to do?
validates with class methods ( validates_* なヘルパーはクラスメソッドです!)
# -*- mode: ruby -*-
class Klass < ActiveRecord::Base
# "undefined ..."
validates_inclusion_of :in => values
# success !
validates_inclusion_of :in => self.values
# cannot be called
def values; end
# can be called
def self.values; end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment