Guido Rumi <[email protected]> writes:

> Oh!
> That was it! Now I feel stupid :P

Well, I don't think it is that obvious, it should probably be possible
for the parser to circumvent this somehow.
https://github.com/erlydtl/erlydtl/issues/21 touches in on the subject,
and after Evan's patch there, the remaining reserved words are

 "not", "and", "in", "or", "as", "by", and "with"

so for the time being, I guess you're somewhat out of luck. :-P

An easy workaround, however, is to define an alias for 'in' in the
model:

 in_alias() ->
     In.

and use this in the template instead:

 mov.in_alias



- Fredrik

> Thanks!
>
>
>
> On Mon, Feb 24, 2014 at 3:45 PM, Fredrik de Vibe <[email protected]>wrote:
>
>> Guido Rumi <[email protected]> writes:
>>
>> > Sure :D
>> >
>> > Im using OTP R16B03-1 with the mock default db.
>> >
>> > *src/model/movement.erl:*
>> >
>> > -module(movement, [Id, Description::string(),In::float(),Out::float()]).
>> > -compile(export_all).
>> >
>> >
>> > *src/controller_orillas_balance_controller.erl*
>> >
>> > -module(orillas_balance_controller, [Req]).
>> > -compile(export_all).
>> >
>> > sheet('GET', []) ->
>> >
>> >     Movements = boss_db:find(movement, []),
>> >      {ok, [{movements, Movements}]}.
>> >
>> > *src/view/balance/sheet.html*
>> >
>> > ..snip...
>> >
>> >  <td>{{ mov.id }}</td>
>> >
>> > ...snip...
>> >
>> > works fine, but
>> >
>> >  <td>{{ mov.in }}</td>
>>
>> I'm guessing 'in' is a reserved token.
>>
>> > crashes CB.
>> >
>> >
>> >
>> >
>> >
>> > On Mon, Feb 24, 2014 at 3:16 PM, Fredrik de Vibe <[email protected]
>> >wrote:
>> >
>> >> Guido Rumi <[email protected]> writes:
>> >>
>> >> > Hi!
>> >> >
>> >> > I'm having this beginner problem, I've thought of dirty hacks but I
>> feel
>> >> > like I'm missing something.
>> >> >
>> >> > If I try to print a float stored in a db with {{ mov.in }} in my
>> view,
>> >> CB
>> >> > crashes with lots of errors and warnings like
>> >> > [error] gen_server boss_web terminated with reason: no case clause
>> >> matching
>> >> > error in boss_load:'-load_views_inner/3-fun-1-'/5 line 408
>> >>
>> >> This should not be a problem, and I also tested with David's fork to
>> >> ascertain this, using the mock db backend (the default).
>> >>
>> >> So, there's something else awry, can you provide more details? What db
>> >> backend do you use? Which erlang version? Can you provide the code in
>> >> question (controller action, model and view (at least the relevant
>> >> part))?
>> >>
>> >> Also, try to print the number in the console, using
>> >>
>> >>  io:format("~p~n", [Value])
>> >>
>> >> to ensure that it is what you think it is.
>> >>
>> >> > I have to make some arithmetic operations and print them in my
>> website.
>> >> I'm
>> >> > using David's fork https://github.com/davidw/ChicagoBoss
>> >> >
>> >> > Does anyone know an easy way to solve this?
>> >> >
>> >> > I've found this patch <
>> >> https://code.google.com/p/erlydtl/issues/detail?id=6>but I'm not sure
>> >> what to do with it.
>> >>
>> >> That is _old_, and it hardly looks relevant. erlydtl lives on github
>> >> now.
>> >>
>> >> > Thanks for your time
>> >>
>> >>
>> >> - Fredrik
>> >>
>> >> --
>> >> 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/ygnmwqgkz89r.fsf%40rubin.ifi.uio.no
>> >> .
>> >> For more options, visit https://groups.google.com/groups/opt_out.
>>
>> --
>> 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/ygnmsir8z6vw.fsf%40rubin.ifi.uio.no
>> .
>> For more options, visit https://groups.google.com/groups/opt_out.

-- 
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/ygnmob1wz17p.fsf%40rubin.ifi.uio.no.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to