I am trying to store an uploaded file with Carrierwave in my Rails application. I have a model that saves data for a (podcast) episode called
Episode. Each episode should have a column
upload for an audio file associated with that episode. To do this, i created an uploader called
EpisodeUploader like this:
rails generate uploader Episode
Note: This is a bit confusing. I have a Model named Episode which has a column named upload, but the uploader is called Episode too (which will end up named EpisodeUploader using the generator.
To make my model use the
EpisodeUploader I added a column named
rails g migration add_upload_to_episodes upload:string
Then, in my Episode model I mounted the uploader
mount_uploader :upload, EpisodeUploader
In my form I added a file field like this:
= f.file_field :upload
Now when I upload a file, no error or anything is thrown, but the file is not stored on my disk and no data has been written to the database.
What am I doing wrong? Is it maybe the naming thing?