0

I try to upload files to Amazon S3 with paperclip gem.

The connection to S3 works fine. in the logs there is mentiond that a connection has started. (No errors in log)

in rails console got this: Completed 200 OK in 16ms (Views: 14.2ms | ActiveRecord: 1.0ms)

But in database there is nothing. And there is no files on S3.

model:

class Movie < ActiveRecord::Base

  # add File to Movie association on column mo
  has_attached_file :movie

  # validdates the file type
  validates_attachment_content_type :movie, :content_type => /\Avideo\/.*\Z/

end

controller:

class MoviesController < ActionController::Base

  # Method to add a new Movie
  def addMovie

    if request.post?
      @movie = Movie.new(movies_params)
      if @movie.save
        redirect_to :addMovie
      end
    else
      @movie = Movie.new
    end

  end


  private

  def movies_params
    params.require(:movie).permit(:movietitle, :movieprice, :locked, :moviedescription, :currency, :language, :movie)
  end

end

LOG

  Parameters: {"utf8"=>"✓", "authenticity_token"=>"DELETED", "movie"=>{"movietitle"=>"sd", "movieprice"=>"1", "currency"=>"d", "language"=>"de", "locked"=>"0", "moviedescription"=>"adasdasd", "movie"=>#<ActionDispatch::Http::UploadedFile:0x00000003e14e68 @tempfile=#<Tempfile:/tmp/RackMultipart20151226-2017-u9g0ym.mp4>, @original_filename="2015-11-14 11.51.27.mp4", @content_type="video/mp4", @headers="Content-Disposition: form-data; name=\"movie[movie]\"; filename=\"2015-11-14 11.51.27.mp4\"\r\nContent-Type: video/mp4\r\n">}, "commit"=>"Save Movie"}
Felix
  • 5,452
  • 12
  • 68
  • 163

0 Answers0