Permalink
Browse files

Merge pull request #17 from projecthydra/date_time

Treat DateTime objects as :time
  • Loading branch information...
2 parents 254073c + fc8cc03 commit b1b70303096a4fd24ceab5a7b5e76b4446b0509e @jcoyne jcoyne committed Apr 19, 2013
Showing with 3 additions and 0 deletions.
  1. +2 −0 lib/solrizer/field_mapper.rb
  2. +1 −0 spec/units/field_mapper_spec.rb
View
2 lib/solrizer/field_mapper.rb
@@ -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
View
1 spec/units/field_mapper_spec.rb
@@ -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

0 comments on commit b1b7030

Please sign in to comment.