Commit b41df53dbe4cf08f72e5b92a5f424a241ca41cff

Authored by Andrew Kane
1 parent 8bc944a2

Updated readme [skip ci]

Showing 1 changed file with 4 additions and 7 deletions   Show diff stats
README.md
... ... @@ -669,13 +669,10 @@ First, add a route and controller action.
669 669 ```ruby
670 670 class MoviesController < ApplicationController
671 671 def autocomplete
672   - render json: Movie.search(params[:query], {
673   - fields: ["title^5", "director"],
674   - match: :word_start,
675   - limit: 10,
676   - load: false,
677   - misspellings: {below: 5}
678   - }).map(&:title)
  672 + movies = Movie.search(params[:query]).fields("title^5", "director").
  673 + match(:word_start).limit(10).load(false).misspellings(below: 5)
  674 +
  675 + render json: movies.map(&:title)
679 676 end
680 677 end
681 678 ```
... ...