ex_admin icon indicating copy to clipboard operation
ex_admin copied to clipboard

no function clause matching in ExAdmin.Helpers.safe_contents/2

Open praveenperera opened this issue 8 years ago • 2 comments

Hey I'm running on the latest Phoenix 1.2.1 / Elixir 1.4.1 and I am getting this error when trying to view created records on ex_admin

    ** (FunctionClauseError) no function clause matching in ExAdmin.Helpers.safe_contents/2
        (ex_admin) lib/ex_admin/helpers.ex:73: ExAdmin.Helpers.safe_contents("", [60, "span", [[32, "class", 61, 34, "utc-datetime", 34], [32, "data-start-time", 61, 34, "2017-02-11T23:30:00+00:00", 34]], 62, "", 60, 47, "span", 62])

praveenperera avatar Feb 07 '17 21:02 praveenperera

I was able to fix it with this commit: https://github.com/praveenperera/ex_admin/commit/d0852a4981234b8068f80759fd34f17e7fcc978f

I am using Phoenix.HTML.safe_to_string() instead of the custom function. Should I send a PR for it?

praveenperera avatar Feb 07 '17 21:02 praveenperera

I came here to report a somewhat similar error, probably should be it's own ticket, but will put here for now.... mine is

Request: GET /admin/users/1
** (exit) an exception was raised:
    ** (FunctionClauseError) no function clause matching in ExAdmin.Table.do_panel_resource/5
        (ex_admin) lib/ex_admin/table.ex:63

Happening with seed data at admin/users/1 in master at https://github.com/MasbiaSoupKitchenNetwork/open_pantry There's also a very similar error in https://github.com/smpallen99/admin_demo_maps also at /admin/users/1 (ie users#show, same place as my error but different message/details), which my code is heavily based on to handle map types. Both are a bit different from @praveenperera 's error above, but similar enough I thought to mention, and since one of them is in @smpallen99 's demo library I thought might help to hunt them down together... I may fork and try and fix myself, I guess that will be a seperate PR if I do, but may fork off this one? Dunno, see how related/similar they turn out to be I guess...

** (exit) an exception was raised:
    ** (CaseClauseError) no case clause matching: nil
        lib/ex_admin/helpers.ex:229: ExAdmin.Helpers.get_resource_model/1
        lib/ex_admin/table.ex:100: ExAdmin.Table.do_panel/4

Edit: Cloned locally to Pry on the error in my code, and immediate issue is ExAdmin.Table#do_panel_resource expects 2nd arg to be a map or struct, and at the moment it is coming through as a tuple (probably one of 3 tuples, the individual key/value pairs in the map). Removing the map match allows it to finish rendering, but it doesn't show any contents in the Credits/map section of show page, so I assume we need a third clause for do_panel_resource but at a glance not sure I know how to write it... if I take a crack later and have any luck will update!

bglusman avatar Feb 09 '17 13:02 bglusman