Socket
Book a DemoInstallSign in
Socket

valid_items

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

valid_items

0.0.11
bundlerRubygems
Version published
Maintainers
1
Created
Source

Valid Items

Goes through all your Rails ActiveRecord objects and check if they are all still pass your model validations. You may have added new validations to your model since creating your object, or ran update_column in your console to solve a production issue. Inspired by a RailsConf talk by Ryan Laughlin and his talk at http://www.rofreg.com/talks/railsconf2018'

Installation

ValidItem's installation is pretty standard:

$ gem install valid_items

If you'd rather install ValidItem using bundler, don't require it in your Gemfile:

gem 'valid_items', require: false

Example usage

require 'valid_items'
ValidItems.checkup
 => User id 203: {:name=>["can't be blank"]}
require 'valid_items'
ValidItems.checkup(email: 'example@example.com')
 => User id 203: {:name=>["can't be blank"]}  
# and an email gets sent
require 'valid_items'
ValidItems.checkup(updated_at: 1.day.ago)
 => 'ok'
Arguments:
 email: (String)
 updated_at: (ActiveSupport::TimeWithZone)

Running in development

Eager Load is required on development, so that valid_items can query all AR models

Rails.application.eager_load!

You must have upgraded your Rails app so that all your models inherit from ApplicationRecord rather than ActiveRecord::Base.

FAQs

Package last updated on 31 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.