dimanche 25 mars 2018

Rails Syntax error in if Statement

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

Aucun commentaire:

Enregistrer un commentaire