Harazzy
Harazzy

Reputation: 201

Carrierwave Direct gem not redirecting after successful upload?

When I upload a file it goes through to my s3 bucket and is all fine there but for some reason my app doesn't redirect? It just stays on the same page. I had a look at the logs and nothing changes, nor do I get back any key.

Heres my form:

= direct_upload_form_for @uploader do |f|
  = f.file_field :text_file
  = f.submit

and my controller

  def upload
    @uploader = Submission.new.text_file
    @uploader.success_action_redirect = new_submission_path
  end

Upvotes: 2

Views: 229

Answers (1)

Hammad Khalid
Hammad Khalid

Reputation: 3490

Instead of setting success_action_redirect to a relative path, you need to set it to a full url:

def upload
  @uploader = Submission.new.text_file
  @uploader.success_action_redirect = root_url
end

Upvotes: 3

Related Questions