karmi/tire — Issue #213: illegal ObjectId format: Lorem
Author: krainboltgreene
Created: 2012-01-22 20:42:01+00:00
State: open

``` ruby
# literature.rb
class Literature
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Versioning
include Tire::Model::Search
include Tire::Model::Callbacks

field :title
field :body
field :rating, type: Integer, default: 0

alias_method :to_indexed_json, :to_json
end
class Story < Literature
end
```

``` ruby
# stories_controller.rb

class Literature::StoriesController < ApplicationController
def new
end

def create
end

def edit
end

def update
end

def index
if params[:query]
@stories = Story.search params[:query], load: true # => illegal ObjectId format: Lorem
else
@stories = Story.all
end
end

def show
end

def search
end
end
```

```
http://localhost:3000/literature/stories?utf8=%E2%9C%93&query=Lorem
```

Any thoughts?