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

Classes require DateTime but do not "require 'date'" #32

Open
atz opened this issue Jan 15, 2015 · 0 comments
Open

Classes require DateTime but do not "require 'date'" #32

atz opened this issue Jan 15, 2015 · 0 comments

Comments

@atz
Copy link

atz commented Jan 15, 2015

Error is: NameError: uninitialized constant Solrizer::FieldMapper::DateTime

Example:

2.1.2 :005 > Solrizer.default_field_mapper.solr_names_and_values("foobar", "xyz", [:searchable, :facetable, :displayable])
NameError: uninitialized constant Solrizer::FieldMapper::DateTime
    from /Users/atz/.rvm/gems/ruby-2.1.2/gems/solrizer-3.3.0/lib/solrizer/field_mapper.rb:168:in `extract_type'
    from /Users/atz/.rvm/gems/ruby-2.1.2/gems/solrizer-3.3.0/lib/solrizer/field_mapper.rb:204:in `block (2 levels) in solr_names_and_values'
    from /Users/atz/.rvm/gems/ruby-2.1.2/gems/solrizer-3.3.0/lib/solrizer/field_mapper.rb:201:in `each'
    from /Users/atz/.rvm/gems/ruby-2.1.2/gems/solrizer-3.3.0/lib/solrizer/field_mapper.rb:201:in `block in solr_names_and_values'
    from /Users/atz/.rvm/gems/ruby-2.1.2/gems/solrizer-3.3.0/lib/solrizer/field_mapper.rb:200:in `each'
    from /Users/atz/.rvm/gems/ruby-2.1.2/gems/solrizer-3.3.0/lib/solrizer/field_mapper.rb:200:in `solr_names_and_values'
    from (irb):5
    from /Users/atz/.rvm/rubies/ruby-2.1.2/bin/irb:11:in `<main>'
2.1.2 :006 > require "date"
 => true 
2.1.2 :007 > Solrizer.default_field_mapper.solr_names_and_values("foobar", "xyz", [:searchable, :facetable, :displayable])
 => {"foobar_teim"=>["xyz"], "foobar_sim"=>["xyz"], "foobar_ssm"=>["xyz"]} 

See:
https://github.com/projecthydra/solrizer/blob/master/lib/solrizer/field_mapper.rb#L168

Note: Code works as long as date is loaded (which probably conceals the bug in most environments).

A similar error could also be elicited from default_descriptors.rb. Add require 'date' to both classes (or base class?) to resolve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant