Using put_flash outside controller

Hi guys,
I’m trying to reuse this functions:


Initially they where inside my auth_controller and I use them to display 1 or more errors with put flash, the problem is that when I put them inside a helper module the put_flash function isn’t available since its only for controllers. I tried sending the module as a parameter but it doesn’t work, also capturing the function and sending it to the function but it doesn’t work either.
I friend told me I can do this using a macro, but to be honest I’ve been reading about macros but I can figure out how can I use them to avoid these problem.
¿Maybe any one knows how can I use macros to achieve what I want?
Thanks in advice!!

Can’t really decipher anything on your screenshot, as my mobile doesn’t load it correctly, everything is vlurred into dark background…

But if you need Phoenix.Controller.put_flash/3, why don’t you call it like that?

3 Likes

Lool it worked perfectly like that, I did something similar yesterday but didn’t work, really appreciate your answer bro! thank you very much

1 Like