This is an issue which pops up from time to time.

The name  "user"  is reserver somewhere in the Erlang ecosystem and
therefore unavailable for our use :-(



On 2 March 2015 at 02:24, David Jacobs <[email protected]> wrote:

> Hi,
>
> That change roleid -> role_id didn't do much at first. But I changed the
> naming from user to something else. Now everything seems to work.
>
> Is there any information on the naming conventions?
>
> Now experimenting with belongs_to & has...
>
> Kind regards,
> david
>
> Op zondag 1 maart 2015 00:14:33 UTC+1 schreef Kai Janson:
>>
>> Shouldn't that be role_id in the table?
>>
>> Sent from my iPhone
>>
>> On Feb 28, 2015, at 2:45 PM, David Jacobs <[email protected]> wrote:
>>
>> Hi,
>>
>> I need an example of a relationship between two models and how the
>> migration tables need to be for postgresql.
>>
>> I want to model roles and users which can all have one and only one role.
>>
>> role.erl:
>>
>> -module(role, [Id, Role_short, Role_long]).
>> -compile(export_all).
>>
>> migration:
>>
>>   CREATE TABLE roles(
>>       id serial unique
>>     , role_short text not null
>>     , role_long text not null
>>   );
>>
>>
>> user.erl
>>
>> -module(user, [Id, Name, Vpe, RoleId]).
>> -compile(export_all).
>>
>> migration:
>>
>>   CREATE TABLE users(
>>       id SERIAL UNIQUE PRIMARY KEY
>>     , name text not null
>>     , vpe text
>>     , roleid integer not null
>>   );
>>
>>
>> Everything compiles, tables are created on db. But when I go to
>> admin-page and continue to model user, then there's an error (listed
>> below). I guess line 4 gives the most detail: "bad arithmetic expression in
>> boss_record_lib:dummy_record/1"?
>>
>> What do I need to adjust? I tried several different variations - but no
>> success.
>>
>> Thanks in advance!
>> david
>>
>> error from console.log:
>> 2015-02-28 20:37:23.007 [info] <0.308.0> Route: "/model/model/user"Url
>> []
>> 2015-02-28 20:37:23.009 [notice] 
>> <0.308.0>@boss_controller_adapter_pmod:action:91
>> Request Method: 'GET', Tokens: ["user"]
>> 2015-02-28 20:37:23.009 [error] <0.295.0> gen_server <0.295.0> terminated
>> with reason: bad arithmetic expression in boss_record_lib:dummy_record/1
>> line 76
>> 2015-02-28 20:37:23.010 [error] <0.295.0> CRASH REPORT Process <0.295.0>
>> with 1 neighbours exited with reason: bad arithmetic expression in
>> boss_record_lib:dummy_record/1 line 76 in gen_server:terminate/7 line 804
>> 2015-02-28 20:37:23.010 [error] <0.98.0> Supervisor
>> {<0.98.0>,poolboy_sup} had child boss_db_controller started with
>> {boss_db_controller,start_link,undefined} at <0.295.0> exit with reason
>> bad arithmetic expression in boss_record_lib:dummy_record/1 line 76 in
>> context child_terminated
>> 2015-02-28 20:37:23.014 [error] 
>> <0.308.0>@boss_web_controller:call_controller_action:319
>> Error in controller exit:{{badarith,
>>           [{boss_record_lib,dummy_record,1,
>>                [{file,"src/boss_record_lib.erl"},{line,76}]},
>>            {boss_record_lib,database_columns,1,
>>                [{file,"src/boss_record_lib.erl"},{line,93}]},
>>            {boss_db_adapter_pgsql,build_conditions,2,
>>                [{file,"src/db_adapters/boss_db_adapter_pgsql.erl"},
>>                 {line,337}]},
>>            {boss_db_adapter_pgsql,count,3,
>>                [{file,"src/db_adapters/boss_db_adapter_pgsql.erl"},{line,
>> 76}]},
>>            {boss_db_controller,handle_call,3,
>>                [{file,"src/boss_db_controller.erl"},{line,138}]},
>>            {gen_server,try_handle_call,4,[{file,"gen_server.erl"},{
>> line,607}]},
>>            {gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,
>> 639}]},
>>            {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,
>> 237}]}]},
>>       {gen_server,call,[<0.295.0>,{count,user,[]},30000]}} Stacktrace:
>> [{gen_server,call,3,[{file,"gen_server.erl"},{line,190}]},
>> {boss_pool,call,3,[{file,"src/boss_pool.erl"},{line,12}]},{
>> cb_admin_model_controller,model,4,[{file,"/home/david/
>> projects/erlang/cb_admin/src/controller/cb_admin_model_
>> controller.erl"},{line,34}]},{boss_web_controller,call_
>> controller_action,3,[{file,"src/boss/boss_web_controller.
>> erl"},{line,316}]},{boss_web_controller,apply_action,4,[{
>> file,"src/boss/boss_web_controller.erl"},{line,308}]},
>> {boss_web_controller,execute_action_inner,9,[{file,"src/
>> boss/boss_web_controller.erl"},{line,287}]},{boss_web_
>> controller_handle_request,process_dynamic_request,5,[{
>> file,"src/boss/boss_web_controller_handle_request.erl"
>> },{line,254}]},{boss_web_controller_handle_request,
>> process_request,5,[{file,"src/boss/boss_web_controller_
>> handle_request.erl"},{line,244}]}]
>> 2015-02-28 20:37:23.017 [error] <0.308.0> Error in controller, see
>> console.log for details
>>
>> 2015-02-28 20:37:23.017 [error] <0.308.0> GET /admin/model/model/user
>> [cb_admin] 500 0ms
>>
>>
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "ChicagoBoss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> Visit this group at http://groups.google.com/group/chicagoboss.
>> To view this discussion on the web visit https://groups.google.com/d/
>> msgid/chicagoboss/af0a1c1f-275a-425d-bdc6-0b0d0327c364%40googlegroups.com
>> <https://groups.google.com/d/msgid/chicagoboss/af0a1c1f-275a-425d-bdc6-0b0d0327c364%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "ChicagoBoss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> Visit this group at http://groups.google.com/group/chicagoboss.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/chicagoboss/8a0b0c1a-13e5-4829-8ac4-9fbe64de3628%40googlegroups.com
> <https://groups.google.com/d/msgid/chicagoboss/8a0b0c1a-13e5-4829-8ac4-9fbe64de3628%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at http://groups.google.com/group/chicagoboss.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/chicagoboss/CAKF5fiDxQZsKZVzub4Kd2Xp-VFN7rOp6HzjBbXUpk8q7UcyAAA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to