How do you order by decimal or date fields?
class CreateUserPrices < ActiveRecord::Migration
def self.up
create_table :user_prices do |t|
t.decimal :price, :precision => 8, :scale => 2
t.date :purchase_date
t.timestamps
end
end
end
I’m trying to sort my user prices to be ordered by price and purchase date.
searchable do
text :product_name do
product.name
end
# field for :price?
# field for :purchase_date?
end
What goes in the model?
Make sure when you add any new code to the
searchable doblock yourake sunspot:reindex.decimalfields use float anddatefields use time