Fox.AtomExt

Source

Summary

infer_collection_key(module)

Takes a controller module and attempts to infer the underscored atom key of its model’s collection. Throws error if not given a controller or the model doesn’t exist

infer_model_key(module)

Takes a controller module and attempts to infer the underscored atom key of its model. Will throw error if not given a controller or the model doesn’t exist

infer_model_module(module)

Takes a controller or view module and attempts to infer its model module name. Will error if not given a controller module or the model doesn’t exist

Functions

infer_collection_key(module)

Takes a controller module and attempts to infer the underscored atom key of its model’s collection. Throws error if not given a controller or the model doesn’t exist.

Examples

MyApp.PictureController |> infer_model_key # :pictures

MyApp.DonkeyPunchController |> infer_model_key # :donkey_punches

Source
infer_model_key(module)

Takes a controller module and attempts to infer the underscored atom key of its model. Will throw error if not given a controller or the model doesn’t exist

Examples

MyApp.MikuHatsuneView |> infer_model_key # :miku_hatsune

MyApp.PictureController |> infer_model_key # :picture

MyApp.DonkeyPunchController |> infer_model_key # :donkey_punch

Source
infer_model_module(module)

Takes a controller or view module and attempts to infer its model module name. Will error if not given a controller module or the model doesn’t exist.

Examples

MyApp.PictureController |> infer_model_module # MyApp.Picture

MyApp.DogFoodView |> infer_model_module # MyApp.DogFood

Source