Sha256: 0b6e06398213a5cc2c5b63baa46bb1d26d04c03f2dd25df7ae9381596df68c84
Contents?: true
Size: 770 Bytes
Versions: 2
Compression:
Stored size: 770 Bytes
Contents
# ActiveWarnings `ActiveModel::Validations` separate for warnings. ## Installation Add this line to your application's Gemfile: ```ruby gem 'active_warnings' ``` And then execute: $ bundle Or install it yourself as: $ gem install active_warnings ## Usage ```ruby class BasicModel include ActiveWarnings attr_accessor :name, :warning_name validates :name, presence: true warnings do # to use same validators, # calling #valid? or #errors will be #no_errors? and #warnings, respectively (on self or record) validates :warning_name, presence: true end end model = BasicModel.new(name: "a") model.valid? # => true model.safe? == model.no_warnings? # => false model.warnings.keys # => [:warning_name] model.errors.keys # => [] ```
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
active_warnings-0.1.1 | README.md |
active_warnings-0.1.0 | README.md |