Guest User

Untitled

a guest
Jul 19th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. before_filter :foos, :only => "index"
  2.  
  3. def index
  4. if @search
  5. @foo = @search
  6. elsif @scope
  7. @foo = @search.foos
  8. else
  9. @foo = Foo.all
  10. end
  11. end
  12.  
  13. private
  14.  
  15. def foos
  16. if params[:search]
  17. @search = Foo.search(params[:search])
  18. end
  19. end
Add Comment
Please, Sign In to add comment