Skip to content

Commit

Permalink
Allow definition of methods that do not map to presented object fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Bantik committed Oct 12, 2012
1 parent 24e4a30 commit 049f08f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/faceted/has_object.rb
Expand Up @@ -30,7 +30,7 @@ def initialize(args={})
end

def reinitialize_with_object(obj)
schema_fields.each{ |k| self.send("#{k}=", obj.send(k)) if self.send(:settable_field?, k) }
schema_fields.each{ |k| self.send("#{k}=", obj.send(k)) if obj.respond_to?(k) && self.send(:settable_field?, k) }
end

def save
Expand All @@ -54,7 +54,7 @@ def to_hash

def initialize_with_object
return unless object
schema_fields.each{ |k| self.send("#{k}=", object.send(k)) if self.respond_to?("#{k}=") }
schema_fields.each{ |k| self.send("#{k}=", object.send(k)) if object.respond_to?(k) && self.respond_to?("#{k}=") }
end

def object
Expand Down

0 comments on commit 049f08f

Please sign in to comment.