Hello,
there is no automatically parsing on assigning numerical values yet.
Following works in ActiveRecord:
class Company < ActiveRecord::Base
attr_accessible :sort_key
end
c = Company.new
c.attributes = {sort_key: '13'}
c.sort_key #=> 13
c.sort_key.class #=> Fixnum
Which doesn't yet work in `Elastictastic':
class Company
include Elastictastic::Document
field :sort_key, type: :integer
end
c = Company.new
c.attributes = {sort_key: '13'}
c.sort_key #=> '13'
c.sort_key.class #=> String
That makes it really unhandy to assign numerical values from request params (for even integer values are submitted as strings).
Would be great if it would work!
Thanx!
Kostia
Hello,
there is no automatically parsing on assigning numerical values yet.
Following works in
ActiveRecord:Which doesn't yet work in `Elastictastic':
That makes it really unhandy to assign numerical values from request params (for even integer values are submitted as strings).
Would be great if it would work!
Thanx!
Kostia