Skip to content

Commit

Permalink
Merge pull request #17 from projecthydra/date_time
Browse files Browse the repository at this point in the history
Treat DateTime objects as :time
  • Loading branch information
jcoyne committed Apr 19, 2013
2 parents 254073c + fc8cc03 commit b1b7030
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/solrizer/field_mapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ def extract_type(value)
when NilClass
when Fixnum
:integer
when DateTime
:time
else
value.class.to_s.underscore.to_sym
end
Expand Down
1 change: 1 addition & 0 deletions spec/units/field_mapper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def fungible_type(type)
@mapper.extract_type(nil).should == nil
@mapper.extract_type(Date.today).should == :date
@mapper.extract_type(Time.now).should == :time
@mapper.extract_type(DateTime.now).should == :time
@mapper.extract_type("Hi").should == :string
end
end
Expand Down

0 comments on commit b1b7030

Please sign in to comment.