Created
October 2, 2013 13:22
-
-
Save johnbintz/6793675 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SearchController < ApplicationController | |
def index | |
@search = MultiSearch.new(params[:query]) | |
# ... do things to @search maybe ... | |
# ... or hand it off to a decorator ... | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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