Created
January 12, 2016 13:54
-
-
Save rachid/432f1e3bece359653939 to your computer and use it in GitHub Desktop.
This file contains 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
defp from_model(resource) when is_map(resource) do | |
resource.__struct__ | |
|> extract | |
end | |
defp from_model(resource) do | |
resource | |
|> extract | |
end | |
defp extract(resource) do | |
resource | |
|> Mix.Utils.underscore | |
|> String.split("/") | |
|> List.last | |
|> to_string | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
om nog cleaner in de module de externals importeren