Create a gist now

Instantly share code, notes, and snippets.

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
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment