Skip to content

Instantly share code, notes, and snippets.

@romaimperator
Created March 12, 2015 02:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save romaimperator/9774a16ff70180445986 to your computer and use it in GitHub Desktop.
Save romaimperator/9774a16ff70180445986 to your computer and use it in GitHub Desktop.
def mapper(date)
if date.last_day_of_month?
date..31
else
date
end
end
@excid3
Copy link

excid3 commented Mar 12, 2015

Fully scope I think would be

  self.ending_on(date)
    days = (date == date.end_of_month) ? (date.day..31) : date.day
    where("extract(day from start_date)" => days)
  end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment