Ruby on Rails Thursday, February 7, 2019

> On Feb 7, 2019, at 3:25 AM, David Merrick <merrickdav@gmail.com> wrote:
>
> I'm not using carrier wave. I'm using paperclip.

Yes, but the same rules apply (on the S3 side) for any attachment system.

Walter

>
> On Thu, Feb 7, 2019 at 9:05 PM Ryan <ryanjwold@gmail.com> wrote:
> Hi David,
>
> Check out this SO article 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+unsubscribe@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.
>
>
> --
> Dave Merrick
>
> Daves Web Designs
>
> Website http://www.daveswebdesigns.co.nz
>
> Email merrickdav@gmail.com
>
> Ph 03 216 2053
>
> Cell 027 3089 169
>
> --
> 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+unsubscribe@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/CA%2B%3DMcKby7nYRSK_3PMMki_qEYHvqc8PR17%3DvQVQiKgShZdeqMg%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@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/865CEC38-F174-4E4E-81A9-17726AC8E87C%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment