You passed the string to: if the exec parameter is proc / function. When it is a string, it tries to find a function with this name. What you really want is an anonymous function using lambda.
class Screen < ActiveRecord::Base
belongs_to :user
validates :screen_size, :numericality => {:less_than_or_equal_to =>100, :greater_than_or_equal_to => 0}, :if => lambda {|s| s.user.access == 1 }
end
class User < ActiveRecord::Base
has_many :screens
attr_accessible :access
end
source
share