Hello i think i'm blind and i don't find the bug in the syntax
def update
@list = List.find_by(key: params[:id])
if (check_email_link(params[:expdate] && @list.update(wishlist_params))
flash[:notice] = t("update")
redirect_to (admin_list_url)
else
flash[:error] = t("not_active")
render 'edit'
end
end
The expdate contains a datetimestamp and the check_email_link is a method that checks the date and time of a link in the mail
There are three syntax errors
app/controllers/admin/lists_controller.rb:32: syntax error, unexpected keyword_else, expecting ')'
app/controllers/admin/lists_controller.rb:35: syntax error, unexpected keyword_end, expecting ')'
app/controllers/admin/lists_controller.rb:86: syntax error, unexpected keyword_end, expecting ')'
I'm an idiot or i'm blind. Can someone help an explain me the error? Thanks
答案 0 :(得分:0)
(check_email_link(params[:expdate] && @list.update(wishlist_params))
has three (
s and two )
s. You need either another )
or one less (
. I can't be sure where, as I don't know your code.
While we're on it, the if
line shouldn't be indented the extra level, as it kinda makes it look like the line above starts a block.