RailsCasts Pro episodes are now free!

Learn more or hide this

HammerInTheNews's Profile

GitHub User: HammerInTheNews

Comments by

Avatar

My import button is not showing up in any browsers. I used this snippet in my customer.rb

ruby
def self.import(file)
 CSV.foreach(file.path, headers: true) do |row|
  Customer.create! row.to_hash  
 end
end

and this in my index.html.erb

ruby
<%= form_tag import_customers_path, multipart: true do %>
  <%= file_field_tag :file %>
  <% submit_tag "Import" %>
<% end %>

Any thoughts?