Cookie Overflow at CSV import

Hi

I have a form for importing a csv file. With every entry in my CSV I
do a delayed background call from a webservice and the result is then
saved to my database. This is working great!

Now I tried a CSV file with over 400 rows. After clicking import in my
form it takes some time and then I get the following error message:
‘ActionDispatch::Cookies::CookieOverflow’. But nevertheless 300 of the
400 jobs are already created in my delayed_jobs table.

The code below is copied from other threads, so I don’t really know
where I save something in cookies. I guess it is at ‘file.tempfile’ in
the controller, but I am not sure.

How can I avoid that error? I found something about using
session_store instead of cookie_store, but I don’t know how to do
that.

I have the following in my controller:

file = params[:file]
CSV.new(file.tempfile, {:headers => false, :col_sep => ";"}).each

do |row|
@list << row[1]
end
end

and this in my view:

<%=form_tag ‘/importcsv/csv_import’, :multipart => true do%>
<%= file_field_tag “file” %>

<%= submit_tag(“Import”) %>
<% end %>

Cheers,
Sebastian

Sebastian,

In order to use session store you have to do the following things,

To create a migration file:
rake db:sessions:create

To create session table:

  • For development mode: rake db:migrate
  • For production mode: rake db:migrate RAILS_ENV=production

Then un-comment the following line from config/environment.rb
config.action_controller.session_store = :active_record_store

restart the app… thats it…

Saravanan K
http://bit.ly/9NpP7e

Saravanan,

I am on rails 3. I don’t know if it is because of that, but I had to
un-comment the line in ‘config/initializers/session_store.rb’ instead
of ‘config/environment.rb’. And the line you send me is deprecated (my
server told me), so I used this instead:
Savon::Application.config.session_store :active_record_store

Thank you so much it worked like a charm!

Sebastian

Saravanan,

I am on rails 3. I don’t know if it is because of that, but I had to
un-comment the line in ‘config/initializers/session_store.rb’ instead
of ‘config/environment.rb’. And the line you send me is deprecated (my
server told me), so I used this instead:
Savon::Application.config.session_store :active_record_store

Thank you so much it worked like a charm!

Sebastian

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs