New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

jqr-negative_named_scope

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jqr-negative_named_scope

  • 0.0.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= Negative Named Scope

Tired of writing both the positive and negative versions of a named_scope? Negative Named Scope will automatically generate the NOT'd version of your named scope.

Warning: Ruby may treat !nil == true but SQL treats NOT NULL as NULL, see: http://en.wikipedia.org/wiki/Null_(SQL)

== Example

named_scope :approved, :conditions => { :approved => true }

=> named_scope :not_approved, :conditions => "NOT (approved = 't')"

named_scope :published, :conditions => { :published => true }, :negative => :unpublished

=> named_scope :unpublished, :conditions => "NOT (published = 't')"

named_scope :created_after, lambda { |value| { :conditions => ['created_after', value] } }

=> named_scope :not_created_after, lambda { |value| :conditions => ["NOT (created_after > = ?)", value] }

suppress the automatic negative named_scope generation

named_scope :great, :conditions => { :great => true }, :negative => false

== Install

As a Rails plugin:

./script/plugin install git://github.com/jqr/negative_named_scope.git

Prefer gems?

gem sources -a http://gems.github.com
gem install jqr-negative_named_scope

Homepage:: http://github.com/jqr/negative_named_scope License:: Copyright (c) 2008 Elijah Miller mailto:elijah.miller@gmail.com, released under the MIT license

FAQs

Package last updated on 11 Aug 2014

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc