Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Try to get carrierwave-neo4j working with neo4j, #235

  • Loading branch information...
commit a1a22438c2e90d8cfeae26b38c92ad58a1ac8f1f 1 parent 43b3362
Andreas Ronge andreasronge authored
Showing with 5 additions and 2 deletions.
  1. +5 −2 lib/neo4j/rails/attributes.rb
7 lib/neo4j/rails/attributes.rb
View
@@ -85,7 +85,7 @@ def attributes=(attributes, guard_protected_attributes = true)
end
def attribute_defaults
- self.class.attribute_defaults
+ self.class.attribute_defaults || {}
end
# Updates this resource with all the attributes from the passed-in Hash and requests that the record be saved.
@@ -231,6 +231,9 @@ def read_attribute(key)
if @_properties.has_key?(key)
@_properties[key]
else
+ #puts "@_properties #{@_properties}"
+ #puts "attribute_defaults #{attribute_defaults.inspect}"
+ #puts "Key #{key}, self #{self}"
@_properties[key] = (!new_record? && _java_entity.has_property?(key)) ? read_property_from_db(key) : attribute_defaults[key]
end
end
@@ -378,7 +381,7 @@ def _classname
# Ensure any defaults are stored in the DB
def write_default_attributes
- self.class.attribute_defaults.each do |attribute, value|
+ self.attribute_defaults.each do |attribute, value|
write_property_from_db(attribute, Neo4j::TypeConverters.convert(value, attribute, self.class, false)) unless changed_attributes.has_key?(attribute) || _java_entity.has_property?(attribute)
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.