芝加哥老板教程
http://www.chicagoboss.org/tutorial.pdf
给出了一个 BossRecord 的示例,该示例在控制器对 GET 的响应中自动转换为 JSON,如下所示:
pull('GET', [LastTimestamp]) ->
{ok, Timestamp, Greetings} = boss_mq:pull("new-greetings", list_to_integer(LastTimestamp)),
{json, [{timestamp, Timestamp}, {greetings, Greetings}]}.
但是,此代码不起作用。boss_json 不会转换从 boss_mq:pull 获得的“问候”记录,并给我一个未处理的错误。我很难弄清楚它想要什么。
16:50:45.634 [error] Unhandled Error: error:function_clause.
Stacktrace: [{boss_json,json_data1,[[{greeting,"greeting-77","zz"}],[],[]],
[{file,"src/boss/boss_json.erl"},{line,31}]},
{boss_json,json_data1,3,[{file,"src/boss/boss_json.erl"},{line,42}]},
{boss_json,encode,2,[{file,"src/boss/boss_json.erl"},{line,16}]},
{boss_web_controller_render,process_action_result,4,[{file,"src/boss/boss_web_controller_render.erl"},{line,171}]},
{boss_web_controller,execute_action_inner,9,[{file,"src/boss/boss_web_controller.erl"},{line,337}]},
{boss_web_controller_handle_request,process_dynamic_request,4,[{file,"src/boss/boss_web_controller_handle_request.erl"},{line,242}]},
{boss_web_controller_handle_request,process_request,4,[{file,"src/boss/boss_web_controller_handle_request.erl"},{line,228}]},
{boss_web_controller_handle_request,set_timer,7,[{file,"src/boss/boss_web_controller_handle_request.erl"},{line,148}]}]
16:50:45.636 [info] POST /greeting/create [cbmonitor] 302 0ms
任何想法为什么教程示例(几年前编写)不再适用于当前版本的 Chicago Boss?