chrismccord / phoenix_haml

Phoenix Template Engine for Haml

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Functions in attributes

DerKobe opened this issue · comments

I ran into a brick wall when I tried to get something like this to work:
%img{src: image(@current_user, 300)}

image/2 is defined in the view, but I always get the error undefined function image/0.

It's no problem with plain values or functions/0. Btw something like this does also not work: %p{alt: @current_user.name}. With this I get protocol Phoenix.HTML.Safe not implemented for %MyApp.User{__meta__: #Ecto.Schema.Metadata....

Ok, it is a Calliope thing and there it is known.

Please use string interpolation. I just successfully tested the following on calliope v0.4.0.

%img{src: "#{image(@current_user, 300)}"}