No commit activity in last 3 years
No release in over 3 years
Adds save!, update!, create!, and find_or_create! to sequel models.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme
Installation:
1) install the gem
gem install sequel_validation_exceptions
2) specify the plugin in your sequel model
plugin :validation_exceptions

In a similar vein to the ActiveRecord ORM, this sequel plugin adds save!, update!, create!, and find_or_create! to the sequel model class. All of these methods will raise a Sequel::ValidationException if validation fails.

Examples:
>> blog = Blog.new :title => ''
>> blog.save!
    Sequel::ValidationException: Could not save new Blog model due to failing validation: {:title=>["is not present"]}

>> blog = Blog.first
>> blog.update! :title => nil
    Sequel::ValidationException: Could not save Blog model due to failing validation: {:title=>["is not present"]}

>> blog = Blog.create!
    Sequel::ValidationException: Could not save new Blog model due to failing validation: {:title=>["is not present"]}

>> blog = Blog.find_or_create! :title => ''
    Sequel::ValidationException: Could not save new Blog model due to failing validation: {:title=>["is not present"]}