Skip to content
This repository has been archived by the owner on Sep 30, 2018. It is now read-only.

Commit

Permalink
Model persistence is now set when first used
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Oct 18, 2013
1 parent d36482b commit 1fc9329
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
6 changes: 0 additions & 6 deletions opal/vienna/model.rb
Expand Up @@ -9,12 +9,6 @@ class Model
include Eventable
extend Eventable

class << self
def inherited(subclass)
subclass.reset!
end
end

attr_accessor :id

def self.from_form(form)
Expand Down
8 changes: 4 additions & 4 deletions opal/vienna/persistence.rb
Expand Up @@ -9,12 +9,12 @@ def adapter(klass = nil)
end

def identity_map
@identity_map
@identity_map ||= {}
end

# Return a simple array of all models
def all
@all
@all ||= RecordArray.new
end

def find(id, &block)
Expand Down Expand Up @@ -60,8 +60,7 @@ def fetch(options = {}, &block)
end

def reset!
@identity_map = {}
@all = RecordArray.new
@identity_map = @all = nil
end
end

Expand Down Expand Up @@ -129,3 +128,4 @@ def did_update
end
end
end

0 comments on commit 1fc9329

Please sign in to comment.