Permalink
Browse files

Fix finders

  • Loading branch information...
1 parent 96504c4 commit 9871ce4d77d7dc4ca5fefe2d42d6e91eeaaef509 Bantik committed Feb 25, 2013
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/faceted/has_object.rb
@@ -25,6 +25,7 @@ def initialize(args={})
self.excludes = args.delete('excludes') || args.delete(:excludes)
unless args.empty?
self.id = args[:id]
+ args.symbolize_keys.delete_if{|k,v| v.nil?}.each{|k,v| self.send("#{k}=", v) if self.respond_to?("#{k}=") && ! v.nil? }
initialize_with_object
args.symbolize_keys.delete_if{|k,v| v.nil?}.each{|k,v| self.send("#{k}=", v) if self.respond_to?("#{k}=") && ! v.nil? }
end
@@ -75,7 +76,7 @@ def initialize_with_object
def object
return unless self.class.klass
- @object ||= self.class.klass.where(find_by => self.send(find_by)).first || self.class.klass.new
+ @object = self.class.klass.where(find_by => self.send(find_by)).first || self.class.klass.new
end
def object=(obj)

0 comments on commit 9871ce4

Please sign in to comment.