I understand there are many questions dealing with the above topic. But when i upload a screenshot from my app to s3 through the Heroku iOS rails tutorial (https://devcenter.heroku.com/articles/ios-photo-sharing-geo-location-service#deploy-to-heroku), I get a success PUT from heroku:
2012-10-10T06:28:39+00:00 app[web.1]: Started POST “/photos” for 163.120.70.10 at 2012-10-10 06:28:39 +0000
2012-10-10T06:28:39+00:00 app[web.1]: Processing by PhotosController#create as JSON
2012-10-10T06:28:39+00:00 app[web.1]: Parameters: {“photo”=>{“owner”=>”f93a107d8795c73d085cab1fbbb9ff2c”, “image”=>#>}}
2012-10-10T06:28:39+00:00 app[web.1]: [paperclip] Saving attachments.
It appears that the record has made it to the pregresql table, which it has:
{“photos”:[{“created_at”:”2012-10-10T02:39:28Z”,”id”:1,”image_content_type”:null,”image_file_name”:null,”image_file_size”:null,”image_updated_at”:null,”owner”:”f93a107d8795c73d085cab1fbbb9ff2c”,”updated_at”:”2012-10-10T02:39:28Z”},{“created_at”:”2012-10-10T02:49:23Z”,”id”:2,”image_content_type”:null,”image_file_name”:null,”image_file_size”:null,”image_updated_at”:null,”owner”:”f93a107d8795c73d085cab1fbbb9ff2c”,”updated_at”:”2012-10-10T02:49:23Z”},{“created_at”:”2012-10-10T05:07:01Z”,”id”:3,”image_content_type”:null,”image_file_name”:null,”image_file_size”:null,”image_updated_at”:null,”owner”:”f93a107d8795c73d085cab1fbbb9ff2c”,”updated_at”:”2012-10-10T05:07:01Z”},{“created_at”:”2012-10-10T05:26:55Z”,”id”:4,”image_content_type”:null,”image_file_name”:null,”image_file_size”:null,”image_updated_at”:null,”owner”:”f93a107d8795c73d085cab1fbbb9ff2c”,”updated_at”:”2012-10-10T05:26:55Z”},{“created_at”:”2012-10-10T05:31:37Z”,”id”:5,”image_content_type”:null,”image_file_name”:null,”image_file_size”:null,”image_updated_at”:null,”owner”:”f93a107d8795c73d085cab1fbbb9ff2c”,”updated_at”:”2012-10-10T05:31:37Z”},{“created_at”:”2012-10-10T05:50:16Z”,”id”:6,”image_content_type”:null,”image_file_name”:null,”image_file_size”:null,”image_updated_at”:null,”owner”:”f93a107d8795c73d085cab1fbbb9ff2c”,”updated_at”:”2012-10-10T05:50:16Z”},{“created_at”:”2012-10-10T06:07:54Z”,”id”:7,”image_content_type”:null,”image_file_name”:null,”image_file_size”:null,”image_updated_at”:null,”owner”:”f93a107d8795c73d085cab1fbbb9ff2c”,”updated_at”:”2012-10-10T06:07:54Z”},{“created_at”:”2012-10-10T06:10:19Z”,”id”:8,”image_content_type”:null,”image_file_name”:null,”image_file_size”:null,”image_updated_at”:null,”owner”:”f93a107d8795c73d085cab1fbbb9ff2c”,”updated_at”:”2012-10-10T06:10:19Z”},{“created_at”:”2012-10-10T06:17:00Z”,”id”:9,”image_content_type”:null,”image_file_name”:null,”image_file_size”:null,”image_updated_at”:null,”owner”:”f93a107d8795c73d085cab1fbbb9ff2c”,”updated_at”:”2012-10-10T06:17:00Z”},{“created_at”:”2012-10-10T06:19:24Z”,”id”:10,”image_content_type”:null,”image_file_name”:null,”image_file_size”:null,”image_updated_at”:null,”owner”:”f93a107d8795c73d085cab1fbbb9ff2c”,”updated_at”:”2012-10-10T06:19:24Z”},{“created_at”:”2012-10-10T06:19:34Z”,”id”:11,”image_content_type”:null,”image_file_name”:null,”image_file_size”:null,”image_updated_at”:null,”owner”:”f93a107d8795c73d085cab1fbbb9ff2c”,”updated_at”:”2012-10-10T06:19:34Z”},{“created_at”:”2012-10-10T06:28:16Z”,”id”:12,”image_content_type”:null,”image_file_name”:null,”image_file_size”:null,”image_updated_at”:null,”owner”:”f93a107d8795c73d085cab1fbbb9ff2c”,”updated_at”:”2012-10-10T06:28:16Z”},{“created_at”:”2012-10-10T06:28:39Z”,”id”:13,”image_content_type”:null,”image_file_name”:null,”image_file_size”:null,”image_updated_at”:null,”owner”:”f93a107d8795c73d085cab1fbbb9ff2c”,”updated_at”:”2012-10-10T06:28:39Z”}]}michael-blums-macbook-pro:cloudglyph-server
As you can see, this is a lot of test uploads. But alas, not of them hit the s3 bucket and there is no indication in the heroku logs as to if it ever got to S3. To be clear, I have no errors such as AWS credential errors. At first, I used an IAM user with just read/write access to my s3 bucket, then switched to my main credentials.
My heroku server is a single host set to the development setting and all my aws credentials are stored in the .env as speced in the tutorial linked above.
Any ideas?
Thanks in advance
Found it. Its a bit of a gotcha. In rails, you need to specify, apparently, the record of your paperclip to successfully write and read to it.
add the following to your model file:
In my case, yourRecord is image as per the json dump up above. Also, i removed the versioning from the heroku tutorial as Paperclip has advanced into the v 3.xx