Skip to content

Instantly share code, notes, and snippets.

@lunaisnotaboy
Created December 2, 2021 00:56
Show Gist options
  • Save lunaisnotaboy/c0d699d92c83c8af9aa3e9d8ee865398 to your computer and use it in GitHub Desktop.
Save lunaisnotaboy/c0d699d92c83c8af9aa3e9d8ee865398 to your computer and use it in GitHub Desktop.
This is for an issue I am having with the Ruby library Shrine

Shrine NoMethodError Issue

This gist contains all the files relevant to the issue.

# frozen_string_literal: true
class ImageUploader < Shrine
# There's actually stuff in here in the actual file, but most of it is sensitive.
# Rest assured, *nothing* in here is causing the problem.
end
<!-- Just the image tag -->
<%= image_tag Topic.find(1).icon_url %>
# frozen_string_literal: true
# == Schema Information
#
# Table name: topics
#
# id :bigint not null, primary key
# description :text default(""), not null
# icon_data :text
# name :string default(""), not null
# created_at :datetime not null
# updated_at :datetime not null
#
class Topic < ApplicationRecord
include TopicIconUploader::Attachment(:icon)
end
# frozen_string_literal: true
class TopicIconUploader < ImageUploader
# Again, since this code is sensitive, this is as much as I can give you. Apologies.
plugin :default_url
Attacher.default_url do |**_options|
'/images/icons/topic.png'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment