I'm new to rails and I am using Rails 4 and the attr_encrypted
gem to encrypt some fields (SSN, names, date of birth, etc ) which will all be inserted into the database in varchar
columns. In the form view, I'm using date_select
to generate the date of birth field (dob), but I am having trouble trying to convert the selected date into a string so that attr_encrypted
can encrypt it for insertion into the database.
_form.html.erb
<%= f.label :dob %><br>
<%= f.date_select :dob, { start_year: 1900, :order => [ :month, :day, :year ] , prompt: true, add_month_numbers: true, use_two_digit_numbers: true } %>
The error given is a mass assignment error, but I don't know how/where (the controller/model) to convert the hash into a string so that the attr_encrypted
gem will be able to encrypt it. What's the best way to accomplish this?