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
import_if_available(Ecto.Query) | |
# alias MyApp.Repo | |
defmodule R do | |
# Old habits die hard. Take a random of something. You don't care which. | |
# > R.take(SomeSchema) | |
def take(schema_or_query) do | |
schema_or_query | |
|> limit(1) | |
|> Repo.one() |