Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit c8e540b

Browse files
committed
chore(typo): modal -> model
1 parent 507c9ec commit c8e540b

File tree

5 files changed

+28
-9
lines changed

5 files changed

+28
-9
lines changed

cover/excoveralls.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

lib/helper/error_handler.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ defmodule Helper.ErrorHandler do
66
alias GroupherServerWeb.Gettext, as: Translator
77

88
def not_found_formater(queryable, id) when is_integer(id) or is_binary(id) do
9-
modal = queryable |> to_string |> String.split(".") |> List.last()
9+
model = queryable |> to_string |> String.split(".") |> List.last()
1010

11-
Translator |> Gettext.dgettext("404", "#{modal}(%{id}) not found", id: id)
11+
Translator |> Gettext.dgettext("404", "#{model}(%{id}) not found", id: id)
1212
end
1313

1414
def not_found_formater(queryable, clauses) do
15-
modal = queryable |> to_string |> String.split(".") |> List.last()
15+
model = queryable |> to_string |> String.split(".") |> List.last()
1616

1717
detail =
1818
clauses
@@ -21,6 +21,6 @@ defmodule Helper.ErrorHandler do
2121
|> List.first()
2222
|> to_string
2323

24-
Translator |> Gettext.dgettext("404", "#{modal}(%{name}) not found", name: detail)
24+
Translator |> Gettext.dgettext("404", "#{model}(%{name}) not found", name: detail)
2525
end
2626
end

lib/helper/orm.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,10 @@ defmodule Helper.ORM do
186186
# query |> Ecto.Query.where(^where) |> Repo.update_all(inc: changes)
187187
# end
188188

189-
def create(modal, attrs) do
190-
modal
189+
def create(model, attrs) do
190+
model
191191
|> struct
192-
|> modal.changeset(attrs)
192+
|> model.changeset(attrs)
193193
|> Repo.insert()
194194
end
195195

test/groupher_server/billing/billing_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ defmodule GroupherServer.Test.Billing do
1818
end
1919

2020
describe "[billing curd]" do
21-
@tag :wip2
21+
@tag :wip
2222
test "create bill record with valid attrs", ~m(user valid_attrs)a do
2323
{:ok, record} = Billing.create_record(user, valid_attrs)
2424

test/helper/orm_test.exs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,25 @@ defmodule GroupherServer.Test.Helper.ORMTest do
1919
{:ok, post: post}
2020
end
2121

22+
# def send_email(to \\ "someone") do
23+
# IO.inspect "send email.. #{to}"
24+
# end
25+
26+
# describe "orm hooks" do
27+
# @tag :wip2
28+
# test "create hooks" do
29+
# user_attrs = mock_attrs(:user)
30+
# user_attrs2 = mock_attrs(:user)
31+
32+
# {:ok, _} = ORM.create(User, user_attrs, %{after_success: [&send_email/1, ["me"] ]})
33+
# {:ok, _} = ORM.create(User, user_attrs2, %{after_success: &send_email/0})
34+
35+
# ORM.create(User, user_attrs, %{after_success: [&Email.notify_admin/2, [user, :new_register] ] })
36+
37+
# true
38+
# end
39+
# end
40+
2241
describe "[find/x find_by]" do
2342
test "find/2 should work, and not preload fields", %{post: post} do
2443
{:ok, found} = ORM.find(Post, post.id)

0 commit comments

Comments
 (0)