Sha256: 50e77f0890f5188bc4e02764363710346970cef05eea55f4e072639f003523af

Contents?: true

Size: 443 Bytes

Versions: 4

Compression:

Stored size: 443 Bytes

Contents

class Post
  include Mongoid::Document
  include Mongoid::Timestamps
  field :title, type: String
  field :body, type: String
  field :tags, type: Array

  PostsSearcher.source(self).title = :title
  PostsSearcher.source(self).body = lambda do |model|
    model.body.gsub(/<.*?>/, "")
  end
  PostsSearcher.source(self).tags = true
  PostsSearcher.source(self).updated_at = true

  def tags=(value)
    super(value.reject(&:blank?))
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
groonga-client-rails-0.9.7 test/apps/rails4-mongoid/app/models/post.rb
groonga-client-rails-0.9.6 test/apps/rails4-mongoid/app/models/post.rb
groonga-client-rails-0.9.5 test/apps/rails4-mongoid/app/models/post.rb
groonga-client-rails-0.9.4 test/apps/rails4-mongoid/app/models/post.rb