Skip to content

Instantly share code, notes, and snippets.

@nicolasblanco
Last active December 21, 2015 10:29
Show Gist options
  • Select an option

  • Save nicolasblanco/6292715 to your computer and use it in GitHub Desktop.

Select an option

Save nicolasblanco/6292715 to your computer and use it in GitHub Desktop.
DE used with any kind of objects in a search controller
class SearchesController < ApplicationController
expose(:search) { Search::Doctor.new(params[:search]) }
expose(:search_results) { search.execute.page(params[:page]) }
expose(:current_day) do
params[:current_day].present? ? Date.parse(params[:current_day]) : Date.today
end
expose(:current_week) do
(current_day.beginning_of_week..current_day.end_of_week).to_a
end
def show
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment