ankane/blind_index

Argument Error

chabgood opened this issue · 5 comments

I am getting this error in the rails log when creating a row:

ArgumentError (must specify an iv):

Here is the create action:

def create
    @disclosure_form = DisclosureForm.find_by(name: params[:name]) || DisclosureForm.new(disclosure_form_params)
    if @disclosure_form.save
      render json: @disclosure_form, status: :created
    else
      render json: @disclosure_form.errors, status: :unprocessable_entity
    end
  end

IT errors on:

render json: @disclosure_form, status: :created

Hey @chabgood, blind index doesn't use an IV, so this is likely an error from attr_encrypted. My guess is you're missing an IV column in your database, but a Google search should be able to tell you more.

I have all columns have an IV. It creates a record, but then it errors.

INSERT INTO `disclosure_forms` (`encrypted_name`, `encrypted_name_iv`, `encrypted_name_bidx`, `encrypted_dob`, `encrypted_dob_iv`, `encrypted_street`, `encrypted_street_iv`, `encrypted_apt_number`, `encrypted_city_state_zip`, `encrypted_city_state_zip_iv`, `encrypted_email`, `encrypted_email_iv`, `encrypted_home_phone`, `encrypted_home_phone_iv`, `encrypted_whatisnst`, `encrypted_whatisnst_iv`, `encrypted_participant`, `encrypted_participant_iv`, `encrypted_pricingandpayment`, `encrypted_pricingandpayment_iv`, `encrypted_finalagreement`, `encrypted_finalagreement_iv`, `created_at`, `updated_at`) VALUES ('WJHnYSv0pcRdPTajxvKhVbTwBjkEL3rGekKMkmw=\n', 'l1vKdGIGoQQVPp2Y\n', '8EjydURYDE4q7sEqVQ0lgJwsWkmJfymHGl/Son3YV/E=\n', 'Lc5+pZXUwyN5HFstRRzIBKFSXXC3IM2hzw==\n', 'O1p0fEd2yS5hdIyv\n', 'EqOl5OaKBh4AMmLPt1wBeSJuzJaI7wyZy7XitE6ZH9WX/eUlDi7U0oRhzB1l\n9hM=\n', 'kdaM26MTy/hkitat\n', '', 'DzjnelNMYHZLgI/UsmJVXdni/96uVQ==\n', 'MwsrD9++WzadIHgv\n', 'vikRTUMzQAZ0V+PPSOGc5bsRDfiLe1xNBStT2cE6JTLipw==\n', '/8ZWcjOoblJd4crx\n', 'F+QCRZH+TgAe442IiurQsX5C0VpEjJetJcY=\n', 'ElqIJBmTGvyr1Wy+\n', 'NjRz868fdpzgME+wXm91qF4x\n', 'vCly7jqf+UN6V08F\n', 'l4RxavVLQJPXR/JA8gcZ2hz+\n', 'S/NskJIDD9cmOEPq\n', '9UVzWDpBiVvV+lX/bW3XMkZe\n', 'hIDthGoLnCEzn4dd\n', 'uhL6b/HY/YUmhmrXka4vOlR55d5GrO53W8sU21A=\n', 'uVkHCMBBTD5xqWNX\n', '2018-06-21 23:44:43', '2018-06-21 23:44:43')
  ↳ app/controllers/disclosure_forms_controller.rb:19
   (5.4ms)  COMMIT
  ↳ app/controllers/disclosure_forms_controller.rb:19
Completed 500 Internal Server Error in 31ms (ActiveRecord: 6.3ms)



ArgumentError (must specify an iv):

app/controllers/disclosure_forms_controller.rb:20:in `create'
^C- Gracefully stopping, waiting for requests to finish
=== puma shutdown: 2018-06-21 19:04:47 -0500 ===
- Goodbye!

From that list, it's missing at least one.

apt_number can be null.