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/2d2750bb-4148-4687-8d9f-d225a3779e4b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to