Skip to content

Commit

Permalink
Refactor CollectionAssociation#reset
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Jun 30, 2015
1 parent 36d5730 commit 6455f0c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions lib/active_fedora/associations/association.rb
Expand Up @@ -24,6 +24,7 @@ def initialize(owner, reflection)
def reset
@loaded = false
@target = nil
@stale_state = nil
@inversed = false
end

Expand Down
8 changes: 3 additions & 5 deletions lib/active_fedora/associations/collection_association.rb
Expand Up @@ -47,8 +47,8 @@ def ids_writer(ids)
end

def reset
reset_target!
@loaded = false
super
@target = []
end

def find(*args)
Expand Down Expand Up @@ -320,10 +320,8 @@ def scope(opts = {})
def null_scope?
owner.new_record? && !foreign_key_present?
end

protected
def reset_target!
@target = Array.new
end

def construct_query
@solr_query ||= begin
Expand Down

0 comments on commit 6455f0c

Please sign in to comment.