In my controller, I improved and prevent dirty code in my project, for example, I was trying to put my params in variable like this:
Original codes :
def create_cms_post(conn, %{
"title" => title,
"status" => status,
"post_type" => post_type,
"download_ext_link" => download_ext_link,
"price" => price,
"pic_x1_link" => pic_x1_link,
"pic_x2_link" => pic_x2_link,
"pic_x3_link" => pic_x3_link,
"group_acl" => group_acl,
"description" => description,
"changelog" => changelog,
"changelog_category" => changelog_category,
"plugin" => plugin,
"plugin_category" => plugin_category,
....
....
....
}) do
create_cms_posts = case PostQuery.insert_post(title, status, post_type, **.... and more ...**) do
when I have done it my code was clear.
Edited codes :
def create_cms_post(conn, %{
"title" => title,
"status" => status,
"post_type" => post_type,
"download_ext_link" => download_ext_link,
"price" => price,
"pic_x1_link" => pic_x1_link,
"pic_x2_link" => pic_x2_link,
....
....
....
} = allreq) do
create_cms_posts = case PostQuery.insert_post(allreq) do
I have put params in one variable and I was putting in my function which I needed.
Now my codes works for me without any problems. but I have many the unused errors when I’m compiling my project.
- first question, does the errors have a bad efect on me ?
- and second , how can I fix this not to show me?
Thanks.