mongoid/mongoid — Issue #1406: Model.defaults returns wrong type (should be Hash but returns Array)
Author: stonegao
Created: 2011-11-03 12:47:54+00:00
State: open

this commit introduced the bug : 1b77d9cf09aa43c4a284be39e5796524850715c0 ,
and it's still wrong in master.

in: lib/mongoid/fields.rb

```ruby

# Returns the default values for the fields on the document.
#
# @example Get the defaults.
# Person.defaults
#
# @return [ Hash ] The field defaults.
def defaults
@defaults ||= []
end

```

in: spec/unit/mongoid/fields_spec.rb

```ruby

require "spec_helper"

describe Mongoid::Fields do

describe ".defaults" do

it "returns a hash of all the default values" do
Game.defaults.should eq([ "high_score", "score" ])
end
end

```