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

jqr-versionable

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jqr-versionable

  • 0.0.3
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= Versionable

Super fast and easy versioning for models and associations. Do cache lookups using this fast version number instead of managing complex cache expiry.

Versionable is intended for versioning of a model or an association and doesn't currently provide any means of caching version numbers for normal model instances.

== Examples

A simple User model with a User.cached_all method that returns all users

in the application. This method is cached and will automatically "expire"

whenever a record is saved or you call User.new_version.

class User < ActiveRecord::Base versionable :cache => Rails.cache

after_save { new_version }

def self.cached_all
  # reference version in cache keys
  Rails.cache.fetch("User.cached_all:#{version}") { all }
end

end

User.cached_all # initial cache miss and cache fill User.cached_all # cache hit

User.new_version # => 1224985243 User.cached_all # new cache miss and cache fill

User.first.save # causing new_version to be called from after_save User.cached_all # new cache miss and cache fill

You can also use it on associations...

== Install

As a Rails plugin.

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

Prefer gems? Add this to your environment.rb and run the following command.

config.gem 'jqr-versionable', :lib => 'versionable', :source => 'http://gems.github.com'

$ rake gems:install

Homepage:: http://github.com/jqr/versionable/tree/master
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