How to create activerecord style validations outside of activerecord?

后端 未结 2 823
一个人的身影
一个人的身影 2021-01-24 08:17

I am working on a testing framework for the software that my company writes. Our product is web based and After I run a RESTful request I want to process the results. I want t

2条回答
  •  南方客
    南方客 (楼主)
    2021-01-24 08:27

    You want Validatable: sudo gem install validatable

    class Person
      include Validatable
      validates_presence_of :name
      attr_accessor :name
    end
    

    Also, Validatable does not have a dependency on ActiveSupport.

提交回复
热议问题