Skip to content

Instantly share code, notes, and snippets.

View aymorgan's full-sized avatar

Adam Morgan aymorgan

  • Careem
  • Dubai, United Arab Emirates
  • X @aymorgan
View GitHub Profile
@aymorgan
aymorgan / _attachment.html.erb
Last active May 7, 2019 14:38
JQuery File Upload, Amazon S3 and Shrine - rendering with a partial
<!-- app/views/attachments/_attachment.html.erb -->
<div class="attachment-image col-xs-6 col-sm-4 col-md-3" id="attachment_<%= @report.slug %><%= attachment.id %>elv1">
<div class="row">
<div class="attached-image-wrapper col-xs-12">
<a class="attached-image" data-lightbox="report-attachment" style="background-image:url('<%= attachment.image_url(:preview) %>');" href="<%= attachment.image_url(:original) %>"></a>
</div>
</div>
<div class="attachment-options-wrapper">
@aymorgan
aymorgan / Introduction
Created January 7, 2018 07:40
Guidance for implementing Algolia.generate_secured_api_key
DISCLAIMER:
Sorry if this is a little long winded but I just want to ensure I communicate it properly (also I'm still learning Ruby & Rails so sorry if some issues are Rails questions than Algolia specific).
MY APP:
My Rails app has the following models:
- Company (has_many :users, has_many :reports)
- User (belongs_to :company, has_many :reports)
- Report (belongs_to :company, belongs_to :user)