Skip to content

Instantly share code, notes, and snippets.

@johnbintz
Created October 2, 2013 13:22
Show Gist options
  • Save johnbintz/6793675 to your computer and use it in GitHub Desktop.
Save johnbintz/6793675 to your computer and use it in GitHub Desktop.
class SearchController < ApplicationController
def index
@search = MultiSearch.new(params[:query])
# ... do things to @search maybe ...
# ... or hand it off to a decorator ...
end
end
class Search
include Virtus
extend ActiveModel::Naming
include ActiveModel::Conversion
attribute :term, String
def persisted?
false
end
def save
true
end
def results
@results ||= MultiSearch.new(term)
end
end
class SearchesController < ApplicationController
# searches are now done with the new and edit methods
inherit_resources
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment