Sha256: bfd2c929f4ed5a17c08e3bc73041d54f2f5e2d7ed3ab65deec33f5ea487fc282
Contents?: true
Size: 776 Bytes
Versions: 9
Compression:
Stored size: 776 Bytes
Contents
require 'pp' require 'pathname' require 'rubygems' require 'adapter/memory' root_path = Pathname(__FILE__).dirname.join('..').expand_path lib_path = root_path.join('lib') $:.unshift(lib_path) require 'toystore' class User include Toy::Store attribute :email, String attribute :my_really_long_field_name, String, :abbr => :my end user = User.create({ :email => 'nunemaker@gmail.com', :my_really_long_field_name => 'something', }) pp Marshal.load(User.adapter.client[user.id]) # Abbreviated attributes are stored in the database as the abbreviation for when you want to conserve space. The abbreviation and the full attribute name work exactly the same in Ruby, the only difference is how they get persisted. # {"my"=>"something", "email"=>"nunemaker@gmail.com"}
Version data entries
9 entries across 9 versions & 1 rubygems