Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

making a clone of _decl_props. #207

Merged
merged 1 commit into from Jul 14, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/neo4j/rails/attributes.rb
Expand Up @@ -240,7 +240,8 @@ module ClassMethods
# Returns all defined properties
def columns
columns = []
self._decl_props.each { |k,v| v.store(:name, k ); columns << Column.new(v) }
props = Marshal.load( Marshal.dump(self._decl_props ))
props.each { |k,v| v.store(:name, k ); columns << Column.new(v) }
columns
end

Expand Down
10 changes: 10 additions & 0 deletions spec/integration/model_spec.rb
Expand Up @@ -742,6 +742,16 @@ def to_s
columns.map { |c| c.index }.should include("exact")
columns.map { |c| c.index }.should_not include("fulltext")
end

it "should not update the models _decl_props hash" do
a_model = create_model do
property :foo, :index => :exact, :type => String
end
a_model.columns
a_model._decl_props.should == {:foo=>{:index=>:exact, :converter=>Neo4j::TypeConverters::StringConverter, :type=>String}}
end


end

end
Expand Down