Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

spray_paint

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spray_paint

  • 0.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

SprayPaint

This is the simplest possible implementation for tagging for ActiveRecord. It does not do any of the fancy things that most of the other tagging libraries (acts-as-taggable-on, acts_as_taggable_on_seroids) do. It doesn't use any real stuff either.

It make this assumption: You want some records to have a #tags attribute.

It's also more ruby friendly. Including modules is better than calling a method to dynamically include another module then define methods. This way, you can override and call super. What a thought right?

Using

Using is simple:

$ bundle exec rake db:migrate SCOPE=spray_paint
class DJ
  include SprayPaint::Tags
end

markus = DJ.new :name => "Markus Schulz"
markus.tags = %w(progressive melodic dark)
markus.save

armin = DJ.new :name => 'Armin van Buuren'
armin.tags = 'noob'
armin.save

# you can also set tags like this:

dj.tags << %w(style1 style2)
dj.tags = 'one-style'

# Finding tagged objects
# The 'tagged' scope works like a set. Find all the records
# who's tags contain these tags.

DJ.tagged('melodic', 'progressive')

That's all folks. It does nothing else.

FAQs

Package last updated on 28 Mar 2012

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