unknown attribute 'account_number' for Customer.
def import
Customer.import(params[:file])
redirect_to customers_path, notice: "Customers Imported."
end
def self.import(file)
CSV.foreach(file.path, headers: true) do |row|
customer_hash = row.to_hash
customer = find_or_create_by!(sla_number: customer_hash['sla_number'])
customer.update(customer_hash)
end
end
<%= form_tag import_customers_path, multipart: true, class: 'form-inline' do %>
<%= file_field_tag :file, class: "" %>
<%= submit_tag "Import CSV", class: "btn btn-info" %>
<% end %>