Skip to content

Instantly share code, notes, and snippets.

@dgoldie
Created September 12, 2014 20:05
Show Gist options
  • Save dgoldie/d632527d4062eee341fc to your computer and use it in GitHub Desktop.
Save dgoldie/d632527d4062eee341fc to your computer and use it in GitHub Desktop.
Phoenix html safe error
[error] ErlangError) erlang error: {:error, :function_clause}
(phoenix) lib/phoenix/html.ex:71: Phoenix.Html.Safe.Tuple.to_string({:safe, [91, [123, [[34, ["name"], 34], 58, [34, ["Eddie"], 34], 44, [34, ["id"], 34], 58, "18", 44, [34, ["fantasy_iq_description"], 34], 58, [34, ["8 Yahoo Seasons"], 34], 44, [34, ["fantasy_iq"], 34], 58, '81.06', 44, [34, ["contests"], 34], 58, "null"], 125], [44, [123, [[34, ["name"], 34], 58, [34, ["Leslie"], 34], 44, [34, ["id"], 34], 58, "16", 44, [34, ["fantasy_iq_description"], 34], 58, [34, ["4 Yahoo Seasons"], 34], 44, [34, ["fantasy_iq"], 34], 58, '78.33', 44, [34, ["contests"], 34], 58, "null"], 125], 44, [123, [[34, ["name"], 34], 58, [34, ["Denny"], 34], 44, [34, ["id"], 34], 58, "17", 44, [34, ["fantasy_iq_description"], 34], 58, [34, ["10 Yahoo Seasons"], 34], 44, [34, ["fantasy_iq"], 34], 58, '77.65', 44, [34, ["contests"], 34], 58, "null"], 125], 44, [123, [[34, ["name"], 34], 58, [34, ["Johnny"], 34], 44, [34, ["id"], 34], 58, "15", 44, [34, ["fantasy_iq_description"], 34], 58, [34, ["3 Yahoo Seasons"], 34], 44, [34, ["fantasy_iq"], 34], 58, '76.45', 44, [34, ["contests"], 34], 58, "null"], 125], 44, [123, [[34, ["name"], 34], 58, [34, ["JJ"], 34], 44, [34, ["id"], 34], 58, "19", 44, [34, ["fantasy_iq_description"], 34], 58, [34, ["5 Yahoo seasons"], 34], 44, [34, ["fantasy_iq"], 34], 58, '76.45', 44, [34, ["contests"], 34], 58, "null"], 125], 44, [123, [[34, ["name"], 34], 58, [34, ["Doug"], 34], 44, [34, ["id"], 34], 58, "14", 44, [34, ["fantasy_iq_description"], 34], 58, [34, ["2 Yahoo Seasons"], 34], 44, [34, ["fantasy_iq"], 34], 58, '73.06', 44, [34, ["contests"], 34], 58, "null"], 125], 44, [123, [[34, ["name"], 34], 58, [34, ["James"], 34], 44, [34, ["id"], 34], 58, "13", 44, [34, ["fantasy_iq_description"], 34], 58, [34, ["1 Yahoo Seasons"], 34], 44, [34, ["fantasy_iq"], 34], 58, '72.0', 44, [34, ["contests"], 34], 58, "null"], 125], 44, [123, [[34, ["name"], 34], 58, [34, ["Alice"], 34], 44, [34, ["id"], 34], 58, "12", 44, [34, ["fantasy_iq_description"], 34], 58, [34, ["1 Yahoo Season"], 34], 44, [34, ["fantasy_iq"], 34], 58, '71.88', 44, [34, ["contests"], 34], 58, "null"], 125], 44, [123, [[34, ["name"], 34], 58, [34, ["George"], 34], 44, [34, ["id"], 34], 58, "11", 44, [34, ["fantasy_iq_description"], 34], 58, [34, ["4 Yahoo Season"], 34], 44, [34, ["fantasy_iq"], 34], 58, '69.3', 44, [34, ["contests"], 34], 58, "null"], 125], 44, [123, [[34, ["name"], 34], 58, [34, ["Xavier"], 34], 44, [34, ["id"], 34], 58, "10", 44, [34, ["fantasy_iq_description"], 34], 58, [34, ["3 Yahoo Seasons"], 34], 44, [34, ["fantasy_iq"], 34], 58, '55.43', 44, [34, ["contests"], 34], 58, "null"], 125]], 93]})
(thor) web/templates/leaderboard/index.html.eex:1: Thor.LeaderboardView."index.html"/1
(phoenix) lib/phoenix/view.ex:88: Phoenix.View.render_within/4
(phoenix) lib/phoenix/controller.ex:141: Phoenix.Controller.render_view/5
(thor) web/controllers/leaderboard.ex:1: Thor.LeaderboardController.plug_builder_call/2
(phoenix) lib/phoenix/router.ex:105: Phoenix.Router.perform_dispatch/2
(thor) web/router.ex:1: Thor.Router.plug_builder_call/2
(plug) lib/plug/adapters/cowboy/handler.ex:7: Plug.Adapters.Cowboy.Handler.init/3
in view:
defmodule Thor.LeaderboardView do
use Thor.Views
alias Poison, as: JSON
in ex file:
<script type="text/javascript" charset="utf-8">
var chart_users = "<%= safe JSON.encode!(@users) %>"
</script>
@dgoldie
Copy link
Author

dgoldie commented Sep 12, 2014

users = [%{contests: nil, fantasy_iq: 81.06, fantasy_iq_description: "8 Yahoo Seasons", id: 18, name: "Eddie"}, %{contests: nil, fantasy_iq: 78.33, fantasy_iq_description: "4 Yahoo Seasons", id: 16, name: "Leslie"}, %{contests: nil, fantasy_iq: 77.65, fantasy_iq_description: "10 Yahoo Seasons", id: 17, name: "Denny"}, %{contests: nil, fantasy_iq: 76.45, fantasy_iq_description: "3 Yahoo Seasons", id: 15, name: "Johnny"}, %{contests: nil, fantasy_iq: 76.45, fantasy_iq_description: "5 Yahoo seasons", id: 19, name: "JJ"}, %{contests: nil, fantasy_iq: 73.06, fantasy_iq_description: "2 Yahoo Seasons", id: 14, name: "Doug"}, %{contests: nil, fantasy_iq: 72.0, fantasy_iq_description: "1 Yahoo Seasons", id: 13, name: "James"}, %{contests: nil, fantasy_iq: 71.88, fantasy_iq_description: "1 Yahoo Season", id: 12, name: "Alice"}, %{contests: nil, fantasy_iq: 69.3, fantasy_iq_description: "4 Yahoo Season", id: 11, name: "George"}, %{contests: nil, fantasy_iq: 55.43, fantasy_iq_description: "3 Yahoo Seasons", id: 10, name: "Xavier"}]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment