diff --git a/lib/planner/tasks/plan.ex b/lib/planner/tasks/plan.ex index 77cd977..f78a8db 100644 --- a/lib/planner/tasks/plan.ex +++ b/lib/planner/tasks/plan.ex @@ -18,6 +18,7 @@ defmodule Planner.Tasks.Plan do plan |> cast(attrs, [:description, :finished_at, :start, :end, :name]) |> validate_required([:name]) + |> update_change(:name, &String.trim/1) end def finish_plan(plan) do diff --git a/lib/planner/tasks/task.ex b/lib/planner/tasks/task.ex index ffb3f23..89dd6e0 100644 --- a/lib/planner/tasks/task.ex +++ b/lib/planner/tasks/task.ex @@ -18,7 +18,7 @@ defmodule Planner.Tasks.Task do task |> cast(attrs, [:value, :finished_at, :due_at]) |> validate_required([:value]) - |> validate_length(:value, min: 3) + |> update_change(:value, &String.trim/1) end def finish_task(task) do