Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 10th, 2012  |  syntax: None  |  size: 0.35 KB  |  hits: 6  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Flexible model with Elasticsearch and Tire
  2. >>> c = Article.new :title =>'New article', :content => { :a => 'a', :b => 'b'}
  3.        
  4. >> Article.last.content
  5. => "---n:a: an:b: bn"
  6.        
  7. class Article
  8.  
  9.   include Tire::Model::Persistence
  10.  
  11.   property :title
  12.   property :published_on, type: 'date'
  13.   property :tags,         analyzer: 'keyword', default: []
  14.  
  15. end