Sha256: 888cbe3d9c89756ed0f10c94e2edcb5b07bd41729faca17bf990d2286ebc17c7
Contents?: true
Size: 893 Bytes
Versions: 40
Compression:
Stored size: 893 Bytes
Contents
# run me with bundle exec ruby -Itest test/example.rb require "test_helper" ActiveRecord::Base.logger = Logger.new(STDOUT) module Twin class Album < Disposable::Twin property :id # DISCUSS: needed for #save. property :name collection :songs, :twin => lambda { |*| Song } extend Representer include Setup include Sync end class Song < Disposable::Twin property :id # DISCUSS: needed for #save. property :title # property :album, :twin => Album extend Representer include Setup include Sync end end album = Album.last twin = Twin::Album.new(album) puts "existing songs (#{twin.songs.size}): #{twin.songs.inspect}" # this is what basically should happen in the representer, returning a Twin. twin.songs << Song.new twin.songs.last.title = "Back To Allentown" puts "new songs (#{twin.songs.size}): #{twin.songs.inspect}" twin.sync
Version data entries
40 entries across 40 versions & 1 rubygems