Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Restore setting custom model id #52

Merged
merged 1 commit into from

2 participants

@jgordor

Prev the Always use record-NN in SQL adapters commit, was possible to set custom id's on record creation, ex: fixtures creation

@evanmiller evanmiller merged commit 6ef7953 into ErlyORM:master
@evanmiller
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 25, 2013
  1. @jgordor
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 0 deletions.
  1. +2 −0  src/db_adapters/boss_db_adapter_mysql.erl
View
2  src/db_adapters/boss_db_adapter_mysql.erl
@@ -256,6 +256,8 @@ build_insert_query(Record) ->
AttributeColumns = Record:database_columns(),
{Attributes, Values} = lists:foldl(fun
({_, undefined}, Acc) -> Acc;
+ ({'id', V}, {Attrs, Vals}) when is_integer(V) ->
+ {[atom_to_list(id)|Attrs], [pack_value(V)|Vals]};
({'id', V}, {Attrs, Vals}) ->
DBColumn = proplists:get_value('id', AttributeColumns),
{_, _, _, TableId} = boss_sql_lib:infer_type_from_id(V),
Something went wrong with that request. Please try again.