Migrating to Picky 3.1 (from 3.0) Tweet
This post is intended for Picky users that are at version 3.0 (or near) and would like to move to version 3.1.
Picky 3.1 is released!
You’re probably wondering: The last post handled upgrading to 3.0, why is there another update so close to it?
First of all, let me say sorry for the quick succession of upgrades. Picky will help you and tell you what to do, as good as it can.
Secondly, Picky’s goal is to be very modular and have exchangeable modules, while not being more complicated to read or use.
What does this have to do with this update?
What has changed?
Instead of defining your memory/redis indexes like so
memory_index = Picky::Indexes::Memory.new :name do # definition end redis_index = Picky::Indexes::Redis.new :name do # definition end
you now only use
Picky::Index.new and pass in the appropriate index backend. Since the memory backend is the default, you don’t need to pass it in. For the Redis backend, you use
memory_index = Picky::Index.new :name do # definition end redis_index = Picky::Index.new :name do backend Picky::Backends::Redis.new # definition end
- Exchangeable backends
- Inheritance is overrated
Double Index. What does it meeeean?
This means that from now on you can pass in your own backend!
We would be quite happy if someone decided to do a purely file-based backend :) Got one? Please contribute! (As an example, see http://github.com/floere/picky/blob/master/server/lib/picky/backends/redis.rb, explanations will follow. Stay tuned!)
This is the main API change in 3.1.
Thanks for reading and have fun! さよなら!!!Next Picky Case Study: Restricting Results
Previous Migrating to Picky 3.0 (from 2.7)