jeudi 30 juillet 2015

Rails flash message not showing up

I'm trying to verify a DEA number by calling an action that calls a verify gem.

Here's the view

  <label for="prescriber_dea_number">DEA number</label>
  <%= text_field_tag :prescriber_dea_number %>
  <%= link_to "Verify DEA number", dea_verification_insight_reports_prescriber_activity_with_patient_request_index_path remote:true %>

Here's the controller action

def dea_verification
dea = params[:prescriber_dea_number]
respond_to do |format|
  if PmpCheckdigit.dea_number?(dea)
    #flash confirmation
    flash[:notice] = "DEA number is valid"
    format.js
  else
    #flash error
    flash[:error] = "DEA number is invalid, Expected something similar to 'AB12345678'"
    format.js
  end
end
end

When the button to Verify is clicked, no flash message appears on the page

Here's what I get in the log

Started GET "/insight_reports/prescriber_activity_with_patient_request/dea_verification" for 127.0.0.1 at 2015-07-30 17:15:34 -0400

AbstractController::ActionNotFound (The action 'show' could not be found for InsightReports::PrescriberActivityWithPatientRequestController):

Aucun commentaire:

Enregistrer un commentaire