Im trying to set up Amazon S3 storage with paperclip in my rails app.
I have a model called "Asset" which belongs to "User"
Here are the first few lines in Asset.rb
attr_accessible :user_id, :uploaded_file
belongs_to :user
#set up "uploaded_file" filed as attached_file(using paperclip)
has_attached_file :uploaded_file,
:path => "assets/:id/:basename.:extension",
:storage => :s3,
:s3_credentials => "#{Rails.root}/config/amazon_s3.yml",
:bucket => "XXXXX"
validates_attachment_size :uploaded_file, :less_than => 1000.megabytes
validates_attachment_presence :uploaded_file
Im getting an error when I load the view:
NoMethodError in AssetsController#create
undefined method `symbolize_keys' for #<String:0x00000103939258>
What does this mean. it has something to do with this line in "Asset.rb" :s3_credentials => "#{Rails.root}/config/amazon_s3.yml",
I looked up on the web and there were several discussions on how Rails_ROOT was deprecated so I used Rails.root instead. Still getting this error.
Also Im storing the AWS key and secret password in a amazon_s3.yml config file.
This is not the best practice, so if anyone has any other ideas, I would love to hear them. heroku says on their website to put the variables as environment variables, however, Im not sure how I would set that up on heroku and also what about when Im on my local development machine? How would that work?
Im just a bit confused, so looking to see if there is a complete example or tutorial out there somewhere. All I could find were deprecated settings.....
Thanks