Hi David,

Check out this SO article 
<https://stackoverflow.com/questions/33276512/proper-s3-permissions-for-users-uploading-image-files-with-carrierwave>
 
that references S3 bucket permissions. Carrierwave needs to be able to 
write to the S3 bucket. Ensure your bucket has Put permissions.


On Wednesday, February 6, 2019 at 8:31:10 PM UTC-8, David Merrick wrote:
>
> Current errors 500 Internal Server Error and Aws::S3::Errors::AccessDenied
>
> My paperclip.rb in config/initializers is below
>
> Paperclip::Attachment.default_options[:url] = ':s3_domain_url'  # Should 
> this line have instead of this ':s3_domain_url'  this '
> mybucketName.s3.amazonaws.com'
> Paperclip::Attachment.default_options[:path] = 
> '/:class/:attachment/:id_partition/:style/:filename'
>
> my production.rb in config/environments this code at the end
>
>  config.paperclip_defaults = {
>    storage: :s3,
>    s3_credentials: {
>      bucket: ENV.fetch('S3_BUCKET_NAME'),
>      access_key_id: ENV.fetch('AWS_ACCESS_KEY_ID'),
>      secret_access_key: ENV.fetch('AWS_SECRET_ACCESS_KEY'),
>      s3_region: ENV.fetch('AWS_REGION'),
>    }
>  }
>
> My pin.rb in models has this code
>
> Class Pin < ApplicationRecord
> belongs_to :user
> has_attached_file :image, styles: { medium: "300x300#", thumb: "100x100>" }
>        validates_attachment_content_type :image, content_type: 
> /\Aimage\/.*\z/
> end
>
> my index.html.erb to view my pins has this code
>
> <%= render 'home/jumbo' unless user_signed_in? %>
> <div class = 'center'>
> <%= will_paginate @pins%>
> </div>
> <div id="container" class="transitions-enabled">
> <% @pins.each do |pin| %> 
> <div class='box'>
> <div class="panel panel-default"> 
>     <%= link_to image_tag(pin.image.url(:medium)),pin %><br>
>     <div class="panel-body">
>     <%= pin.description %><br>
>     <strong><%= pin.user.name if pin.user %></strong>
> </div> 
>     <%#= link_to 'Show', pin %>
>     <% if pin.user == current_user %>
>     <div class="panel-footer">
>       <%= link_to 'Edit', edit_pin_path(pin) %>
>       <%= link_to 'Destroy', pin, method: :delete, data: { confirm: 'Are 
> you sure?' } %>
>     </div>
>     <% end %> 
> </div>
> </div>
> <% end %> 
> </div>
>
> What else am I missing to connect Heroku to AWS S3 Bucket to upload and 
> store images?
>
> Cheers Dave
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/0bc96cca-11e0-449a-9652-53a359bb799d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to