repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/test/lib/email_processor_test.rb | test/lib/email_processor_test.rb | require 'test_helper'
class EmailProcessorTest < ActiveSupport::TestCase
setup do
set_default_settings
end
test 'an email to the support address from an unknown user should create a new user and topic with status new' do
assert_difference('Topic.where(current_status: "new").count', 1) do
assert_d... | ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/test/mailers/notification_mailer_test.rb | test/mailers/notification_mailer_test.rb | require 'test_helper'
class NotificationMailerTest < ActionMailer::TestCase
def setup
set_default_settings
end
def disable_all_notifications
User.agents.each do |a|
a.notify_on_private = false
a.notify_on_public = false
a.notify_on_reply = false
a.save!
end
end
# This t... | ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/test/mailers/post_mailer_test.rb | test/mailers/post_mailer_test.rb | require 'test_helper'
class PostMailerTest < ActionMailer::TestCase
setup do
set_default_settings
end
test 'No mail sent if email is temporary placeholder' do
topic = Topic.first
user = topic.user
user.email = "change@me-something.com"
user.save!
post = topic.posts.first
email = Po... | ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/test/mailers/test_mailer_test.rb | test/mailers/test_mailer_test.rb | require 'test_helper'
class TestMailerTest < ActionMailer::TestCase
# test "the truth" do
# assert true
# end
end
| ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/test/mailers/user_mailer_test.rb | test/mailers/user_mailer_test.rb | require 'test_helper'
class UserMailerTest < ActionMailer::TestCase
setup do
set_default_settings
AppSettings['settings.welcome_email'] = '0'
end
test 'No mail sent if setting disabled' do
user = users(:user)
email = UserMailer.new_user(user.id, 'token')
assert_emails 0 do
email.deli... | ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/test/mailers/previews/user_mailer_preview.rb | test/mailers/previews/user_mailer_preview.rb | # Preview all emails at http://localhost:3000/rails/mailers/usert_mailer
class UserMailerPreview < ActionMailer::Preview
def new_user
UserMailer.new_user(User.last,'xyz')
end
end
| ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/test/mailers/previews/notification_mailer_preview.rb | test/mailers/previews/notification_mailer_preview.rb | # Preview all emails at http://localhost:3000/rails/mailers/notification_mailer
class NotificationMailerPreview < ActionMailer::Preview
def new_private
NotificationMailer.new_private(Topic.last.id)
end
def new_public
NotificationMailer.new_public(Topic.last.id)
end
def new_reply
NotificationMai... | ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/test/mailers/previews/topic_mailer_preview.rb | test/mailers/previews/topic_mailer_preview.rb | # Preview all emails at http://localhost:3000/rails/mailers/topic_mailer
class TopicMailerPreview < ActionMailer::Preview
end
| ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/test/mailers/previews/backup_mailer_preview.rb | test/mailers/previews/backup_mailer_preview.rb | class BackupMailerPreview < ActionMailer::Preview
def backup_completion
BackupMailer.notify_backup_complition(User.find(3),'User')
end
end
| ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/test/mailers/previews/devise_mailer_preview.rb | test/mailers/previews/devise_mailer_preview.rb | class Devise::MailerPreview < ActionMailer::Preview
def invitation_instructions
DeviseMailer.invitation_instructions(User.first, "faketoken", {})
end
def reset_password_instructions
DeviseMailer.reset_password_instructions(User.first, "faketoken", {})
end
end
| ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/test/mailers/previews/post_mailer_preview.rb | test/mailers/previews/post_mailer_preview.rb | # Preview all emails at http://localhost:3000/rails/mailers/post_mailer
class PostMailerPreview < ActionMailer::Preview
def new_post
PostMailer.new_post(Post.last.id)
end
end
| ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/test/mailers/previews/test_mailer_preview.rb | test/mailers/previews/test_mailer_preview.rb | # Preview all emails at http://localhost:3000/rails/mailers/test_mailer
class TestMailerPreview < ActionMailer::Preview
end
| ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/test/mailers/previews/import_mailer_preview.rb | test/mailers/previews/import_mailer_preview.rb | class ImportMailerPreview < ActionMailer::Preview
def import_completion
ImportMailer.notify_import_complition(User.find(3),'User','Your import was successful')
end
end
| ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/lib/email_processor.rb | lib/email_processor.rb | class EmailProcessor
def initialize(email)
@email = email
@tracker = Staccato.tracker(AppSettings['settings.google_analytics_id']) if google_analytics_enabled?
@spam_score = @email.spam_score.present? ? @email.spam_score.to_f : 0
end
def process
# Guard clause to prevent ESPs like Sendgrid f... | ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/lib/generators/theme/theme_generator.rb | lib/generators/theme/theme_generator.rb | class Theme < Rails::Generators::Base
source_root File.expand_path("../templates", __FILE__)
argument :theme_name, type: :string
desc "Creates a new theme"
def create_theme_directory
empty_directory theme_views_layout
empty_directory theme_images_directory
empty_directory theme_javascript... | ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/lib/devise/custom_failure.rb | lib/devise/custom_failure.rb | class CustomFailure < Devise::FailureApp
def redirect_url
I18n.locale = params[:locale] if params[:locale]
new_user_session_path
end
def respond
if http_auth?
http_auth
else
redirect
end
end
end
| ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/lib/sentence_case/sentence_case.rb | lib/sentence_case/sentence_case.rb | class String
def sentence_case
self.sub(/^(.)/) { $1.capitalize }
end
end
| ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/application.rb | config/application.rb | require File.expand_path('../boot', __FILE__)
require 'rails/all'
require "attachinary/orm/active_record"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Helpy
class Application < Rails::Application
config.... | ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/environment.rb | config/environment.rb | # Load the Rails application.
require File.expand_path('../application', __FILE__)
# Initialize the Rails application.
Rails.application.initialize!
# Get the current tag version
VERSION = '2.8.0'
REVISION = `git log --pretty=format:'%h' -n 1`
APP_VERSION = "#{VERSION}:#{REVISION}"
| ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/puma.rb | config/puma.rb | environment ENV.fetch 'RAILS_ENV', 'production'
threads 0, 16
bind 'tcp://0.0.0.0:3000'
on_worker_boot do
ActiveRecord::Base.establish_connection
end | ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/routes.rb | config/routes.rb | Rails.application.routes.draw do
root to: "locales#redirect_on_locale"
devise_for :users, skip: [:password, :registration, :confirmation, :invitations], controllers: { omniauth_callbacks: 'omniauth_callbacks' }
as :user do
get "/users/invitation/accept" => "devise/invitations#edit", as: :accept_user_invit... | ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/unicorn.rb | config/unicorn.rb | # If you have a very small app you may be able to
# increase this, but in general 3 workers seems to
# work best
worker_processes 3
# Load your app into the master before forking
# workers for super-fast worker spawn times
preload_app true
# Immediately restart any workers that
# haven't responded within 30 seconds
t... | ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/boot.rb | config/boot.rb | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' # Set up gems listed in the Gemfile.
| ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/initializers/route_translator.rb | config/initializers/route_translator.rb | RouteTranslator.config do |config|
config.force_locale = true
config.locale_param_key = :locale
end
| ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/initializers/filter_parameter_logging.rb | config/initializers/filter_parameter_logging.rb | # Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password]
| ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/initializers/client_side_validations.rb | config/initializers/client_side_validations.rb | # ClientSideValidations Initializer
# Disabled validators. The uniqueness validator is disabled by default for security issues. Enable it on your own responsibility!
# ClientSideValidations::Config.disabled_validators = [:uniqueness]
# Uncomment to validate number format with current I18n locale
# ClientSideValidatio... | ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/initializers/default_settings.rb | config/initializers/default_settings.rb | # General Settings:
AppSettings.defaults["branding.ticketing_color"] = "#245566"
AppSettings.defaults["branding.ticketing_bg_color"] = "#f6f7e8"
AppSettings.defaults["branding.ticketing_bg_image"] = ""
AppSettings.defaults["branding.display_branding"] = "1"
AppSettings.defaults["settings.enforce_ssl"] = "0"
AppSettin... | ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/initializers/fog-aws.rb | config/initializers/fog-aws.rb | CarrierWave.configure do |config|
config.fog_provider = 'fog/aws'
if Rails.env == 'test'
config.fog_credentials = {
provider: 'AWS',
aws_access_key_id: 'secretkeyid',
aws_secret_access_key: 'secretaccesskey',
region: 'abc',
endpoint: ... | ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/initializers/session_store.rb | config/initializers/session_store.rb | # Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: '_helpy_session'
| ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/initializers/devise.rb | config/initializers/devise.rb | # Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
require 'devise/custom_failure'
Devise.setup do |config|
#This sets up a cookie to generate the above_header with javascript
Warden::Manager.after_set_user do |user,auth... | ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/initializers/swagger.rb | config/initializers/swagger.rb | GrapeSwaggerRails.options.before_action do
GrapeSwaggerRails.options.app_url = request.protocol + request.host_with_port
unless current_user && current_user.is_agent?
redirect_to(request.protocol + request.host_with_port)
end
end
GrapeSwaggerRails.options.url = "/swagger_doc.json"
GrapeSwaggerRails.opt... | ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/initializers/griddler.rb | config/initializers/griddler.rb | require 'email_processor'
Griddler.configure do |config|
config.processor_class = EmailProcessor # CommentViaEmail
config.processor_method = :process # :create_comment (A method on CommentViaEmail)
config.reply_delimiter = '--- Make sure your reply appears above this line ---'
config.email_service = Settings.m... | ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/initializers/patch_for_action_controller_test_response.rb | config/initializers/patch_for_action_controller_test_response.rb | if RUBY_VERSION>='2.6.0'
if Rails.version < '5'
class ActionController::TestResponse < ActionDispatch::TestResponse
def recycle!
# hack to avoid MonitorMixin double-initialize error:
@mon_mutex_owner_object_id = nil
@mon_mutex = nil
initialize
end
end
else
log... | ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/initializers/wrap_parameters.rb | config/initializers/wrap_parameters.rb | # Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters f... | ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/initializers/pg_search.rb | config/initializers/pg_search.rb | PgSearch.multisearch_options = { :using => { :tsearch => {:prefix => true, :dictionary => "english"} } } | ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/initializers/omniauth.rb | config/initializers/omniauth.rb | # Allow only POST to mitigate CVE-2015-9284, see
# https://github.com/omniauth/omniauth/wiki/Resolving-CVE-2015-9284
# TODO: remove once https://github.com/omniauth/omniauth/pull/809 is resolved
OmniAuth.config.allowed_request_methods = [:post] | ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/initializers/inflections.rb | config/initializers/inflections.rb | # Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflec... | ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/initializers/simple_form_bootstrap.rb | config/initializers/simple_form_bootstrap.rb | # Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
config.error_notification_class = 'alert alert-danger'
config.button_class = 'btn btn-default'
config.boolean_label_class = nil
config.wrappers :vertical_form, tag: 'div', class: 'form-group', error_class: 'ha... | ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/initializers/kaminari_config.rb | config/initializers/kaminari_config.rb | Kaminari.configure do |config|
config.default_per_page = 20
# config.max_per_page = nil
# config.window = 4
# config.outer_window = 0
# config.left = 0
# config.right = 0
# config.page_method_name = :page
# config.param_name = :page
end
| ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/initializers/hash_id.rb | config/initializers/hash_id.rb | Hashid::Rails.configure do |config|
# The salt to use for generating hashid. Prepended with table name.
config.salt = 'salt'
# The minimum length of generated hashids
config.min_hash_length = 12
# The alphabet to use for generating hashids
config.alphabet = "abcdefghijklmnopqrstuvwxyz" \
... | ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/initializers/backport_pg_10_support_to_rails_4.rb | config/initializers/backport_pg_10_support_to_rails_4.rb | require 'active_record/connection_adapters/postgresql/schema_statements'
#
# Monkey-patch the refused Rails 4.2 patch at https://github.com/rails/rails/pull/31330
#
# Updates sequence logic to support PostgreSQL 10.
#
module ActiveRecord
module ConnectionAdapters
module PostgreSQL
module SchemaStatements
... | ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/initializers/simple_form.rb | config/initializers/simple_form.rb | # Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
# Wrappers are used by the form builder to generate a
# complete input. You can remove any component from the
# wrapper, change the order or even add your own to the
# stack. The options given below are used to... | ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/initializers/cookies_serializer.rb | config/initializers/cookies_serializer.rb | # Be sure to restart your server when you modify this file.
Rails.application.config.action_dispatch.cookies_serializer = :json
| ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/initializers/config.rb | config/initializers/config.rb | Config.setup do |config|
config.const_name = "Settings"
config.use_env = true
end
| ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/initializers/assets.rb | config/initializers/assets.rb | # Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
# Add additional assets to the asset load path
# Rails.application.config.assets.paths << Emoji.images_path
# Precompile additional ... | ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/initializers/sucker_punch.rb | config/initializers/sucker_punch.rb | # config/initializers/sucker_punch.rb
require 'sucker_punch/async_syntax'
| ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/initializers/actionview_fix.rb | config/initializers/actionview_fix.rb | ActionView::Helpers::JavaScriptHelper::JS_ESCAPE_MAP.merge!(
{
"`" => "\\`",
"$" => "\\$"
}
)
module ActionView::Helpers::JavaScriptHelper
alias :old_ej :escape_javascript
alias :old_j :j
def escape_javascript(javascript)
javascript = javascript.to_s
if javascript.empty?
result = ""
... | ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/initializers/acts_as_taggable_on.rb | config/initializers/acts_as_taggable_on.rb | ActsAsTaggableOn.delimiter = ','
| ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/initializers/sentence_case.rb | config/initializers/sentence_case.rb | require "#{ Rails.root }/lib/sentence_case/sentence_case.rb"
| ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/initializers/backtrace_silencers.rb | config/initializers/backtrace_silencers.rb | # Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a probl... | ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/initializers/mime_types.rb | config/initializers/mime_types.rb | # Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
| ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/environments/test.rb | config/environments/test.rb | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suit... | ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/environments/development.rb | config/environments/development.rb | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
#config.i18n.default_locale = :en
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since y... | ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
helpyio/helpy | https://github.com/helpyio/helpy/blob/26aff0e485aee91f41098ee986cfe750746dcfee/config/environments/production.rb | config/environments/production.rb | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... | ruby | MIT | 26aff0e485aee91f41098ee986cfe750746dcfee | 2026-01-04T15:54:37.819890Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/spec/refile_spec.rb | spec/refile_spec.rb | require "refile"
RSpec.describe Refile do
before do
allow(Refile).to receive(:token).and_return("token")
allow(Refile).to receive(:app_host).and_return(nil)
allow(Refile).to receive(:mount_point).and_return(nil)
end
let(:klass) do
Class.new do
extend Refile::Attachment
attr_accessor ... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/spec/refile/test_app.rb | spec/refile/test_app.rb | require "yaml"
require "rails/all"
require "refile"
require "refile/rails"
require "jquery/rails"
module Refile
class TestApp < Rails::Application
config.middleware.delete "ActionDispatch::Cookies"
config.middleware.delete "ActionDispatch::Session::CookieStore"
config.middleware.delete "ActionDispatch::... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/spec/refile/custom_logger_spec.rb | spec/refile/custom_logger_spec.rb | require "refile/custom_logger"
describe Refile::CustomLogger do
let(:rack_app) do
->(_) { [200, {}, ["Success"]] }
end
let(:io) { StringIO.new }
let(:env) do
{ "QUERY_STRING" => "",
"REQUEST_METHOD" => "POST",
"PATH_INFO" => "/" }
end
let(:expected_format) { %r{Prefix: \[[^\]]+\] POST ... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/spec/refile/attachment_helper_spec.rb | spec/refile/attachment_helper_spec.rb | require "refile/rails/attachment_helper"
require "refile/active_record_helper"
require "refile/attachment/active_record"
require "action_view"
describe Refile::AttachmentHelper do
include Refile::AttachmentHelper
include ActionView::Helpers::AssetTagHelper
include ActionView::Helpers::FormHelper
let(:klass) d... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/spec/refile/backend_macros_spec.rb | spec/refile/backend_macros_spec.rb | RSpec.describe Refile::BackendMacros do
let(:klass) do
Class.new do
extend Refile::BackendMacros
attr_accessor :max_size
verify_uploadable def upload(uploadable)
uploadable
end
verify_id def get(id)
id
end
end
end
let(:instance) { klass.new }
descr... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/spec/refile/attachment_spec.rb | spec/refile/attachment_spec.rb | require "refile/active_record_helper"
require_relative "support/accepts_attachments_for_shared_examples"
describe Refile::Attachment do
let(:options) { {} }
let(:klass) do
opts = options
Class.new do
extend Refile::Attachment
attr_accessor :document_id, :document_filename, :document_size, :doc... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/spec/refile/active_record_helper.rb | spec/refile/active_record_helper.rb | require "active_record"
I18n.enforce_available_locales = true
ActiveRecord::Base.establish_connection(
adapter: "sqlite3",
database: File.expand_path("test_app/db/db.sqlite", File.dirname(__FILE__)),
verbosity: "quiet"
)
class TestMigration < ActiveRecord::Migration[5.0]
def self.up
create_table :posts, ... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/spec/refile/backend_examples.rb | spec/refile/backend_examples.rb | RSpec.shared_examples_for :backend do
def uploadable(data = "hello")
Refile::FileDouble.new(data)
end
describe "#upload" do
it "raises ArgumentError when invalid object is uploaded" do
expect { backend.upload(double(size: 123)) }.to raise_error(Refile::InvalidFile)
expect { backend.upload("he... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/spec/refile/app_spec.rb | spec/refile/app_spec.rb | require "rack/test"
describe Refile::App do
include Rack::Test::Methods
def app
res = Refile::App.new
res.settings.set :public_folder, ""
res
end
before do
allow(Refile).to receive(:token).and_return("token")
end
describe "GET /:backend/:id/:filename" do
it "returns a stored file" do... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/spec/refile/download_spec.rb | spec/refile/download_spec.rb | describe Refile::Download do
context "without redirects" do
it "fetches the file" do
stub_request(:get, "http://www.example.com/dummy").to_return(
status: 200,
body: "dummy",
headers: { "Content-Length" => 5, "Content-Type" => "text/plain" }
)
download = described_class.... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/spec/refile/spec_helper.rb | spec/refile/spec_helper.rb | ENV["RACK_ENV"] = "test"
require "refile"
require "refile/backend_examples"
require "webmock/rspec"
require "refile/file_double"
tmp_path = Dir.mktmpdir
WebMock.disable_net_connect!(allow_localhost: true)
at_exit do
FileUtils.remove_entry_secure(tmp_path)
end
Refile.store = Refile::Backend::FileSystem.new(File.e... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/spec/refile/test_app/app/controllers/simple_form_posts_controller.rb | spec/refile/test_app/app/controllers/simple_form_posts_controller.rb | class SimpleFormPostsController < DirectPostsController
end
| ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/spec/refile/test_app/app/controllers/home_controller.rb | spec/refile/test_app/app/controllers/home_controller.rb | class HomeController < ApplicationController
def index
end
end
| ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/spec/refile/test_app/app/controllers/single_posts_controller.rb | spec/refile/test_app/app/controllers/single_posts_controller.rb | class SinglePostsController < ApplicationController
def new
@post = Post.new
render :form
end
def create
@post = Post.new(post_params)
if @post.save
redirect_to [:normal, @post]
else
render :form
end
end
def edit
@post = Post.find(params[:id])
render :form
end
... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/spec/refile/test_app/app/controllers/direct_posts_controller.rb | spec/refile/test_app/app/controllers/direct_posts_controller.rb | class DirectPostsController < ApplicationController
def new
@post = Post.new
end
def create
@post = Post.new(params.require(:post).permit(:title, :document, :image, :requires_document, documents_files: []))
if @post.save
redirect_to [:normal, @post]
else
render :new
end
end
end... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/spec/refile/test_app/app/controllers/normal_posts_controller.rb | spec/refile/test_app/app/controllers/normal_posts_controller.rb | class NormalPostsController < ApplicationController
def index
@posts = Post.all
end
def show
@post = Post.find(params[:id])
end
def new
@post = Post.new
end
def edit
@post = Post.find(params[:id])
end
def create
@post = Post.new(post_params)
if @post.save
redirect_to... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/spec/refile/test_app/app/controllers/multiple_posts_controller.rb | spec/refile/test_app/app/controllers/multiple_posts_controller.rb | class MultiplePostsController < ApplicationController
def new
@post = Post.new
render :form
end
def create
@post = Post.new(post_params)
if @post.save
redirect_to [:normal, @post]
else
render :form
end
end
def edit
@post = Post.find(params[:id])
render :form
en... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/spec/refile/test_app/app/controllers/presigned_posts_controller.rb | spec/refile/test_app/app/controllers/presigned_posts_controller.rb | class PresignedPostsController < ApplicationController
def new
@post = Post.new
end
def create
@post = Post.new(params.require(:post).permit(:title, :document, documents_files: []))
if @post.save
redirect_to [:normal, @post]
else
render :new
end
end
def upload
if params[... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/spec/refile/test_app/app/controllers/application_controller.rb | spec/refile/test_app/app/controllers/application_controller.rb | class ApplicationController < ActionController::Base
end
| ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/spec/refile/test_app/app/models/post.rb | spec/refile/test_app/app/models/post.rb | class Post < ActiveRecord::Base
attr_accessor :requires_document
attachment :image, type: :image
attachment :document, cache: :limited_cache
validates_presence_of :title
has_many :documents, dependent: :destroy
accepts_attachments_for :documents
validates_presence_of :document, if: :requires_document?
... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/spec/refile/test_app/app/models/document.rb | spec/refile/test_app/app/models/document.rb | class Document < ActiveRecord::Base
belongs_to :post
attachment :file, cache: :limited_cache
end
| ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/spec/refile/test_app/config/routes.rb | spec/refile/test_app/config/routes.rb | Refile::TestApp.routes.draw do
root to: "home#index"
scope path: "normal", as: "normal" do
resources :posts, controller: "normal_posts"
end
scope path: "multiple", as: "multiple" do
resources :posts, controller: "multiple_posts"
end
scope path: "direct", as: "direct" do
resources :posts, only... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/spec/refile/support/accepts_attachments_for_shared_examples.rb | spec/refile/support/accepts_attachments_for_shared_examples.rb | RSpec.shared_examples "accepts_attachments_for" do
describe "#:association_:name=" do
it "builds records from assigned files" do
post.documents_files = [
Refile::FileDouble.new("hello", content_type: "image/jpeg"),
Refile::FileDouble.new("world", content_type: "image/jpeg")
]
pos... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/spec/refile/attachment/active_record_spec.rb | spec/refile/attachment/active_record_spec.rb | require "refile/active_record_helper"
require "refile/attachment/active_record"
require_relative "../support/accepts_attachments_for_shared_examples"
describe Refile::ActiveRecord::Attachment do
let(:options) { {} }
let(:required) { false }
let(:klass) do
opts = options
req = required
Class.new(Activ... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/spec/refile/backend/file_system_spec.rb | spec/refile/backend/file_system_spec.rb | RSpec.describe Refile::Backend::FileSystem do
let(:backend) { Refile::Backend::FileSystem.new(File.expand_path("tmp/store1", Dir.pwd), max_size: 100) }
it_behaves_like :backend
end
| ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/spec/refile/features/normal_upload_spec.rb | spec/refile/features/normal_upload_spec.rb | require "refile/test_app"
feature "Normal HTTP Post file uploads" do
scenario "Successfully upload a file" do
visit "/normal/posts/new"
fill_in "Title", with: "A cool post"
attach_file "Document", path("hello.txt")
click_button "Create"
expect(page).to have_selector("h1", text: "A cool post")
... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/spec/refile/features/single_upload_spec.rb | spec/refile/features/single_upload_spec.rb | require "refile/test_app"
feature "single attribute form upload" do
scenario "upload a single file insteaf of an array of files" do
visit "/single/posts/new"
fill_in "Title", with: "A cool post"
attach_file "Documents", path("hello.txt")
click_button "Create"
expect(download_link("Document: hell... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/spec/refile/features/multiple_upload_spec.rb | spec/refile/features/multiple_upload_spec.rb | require "refile/test_app"
feature "Multiple file uploads", :js do
scenario "Upload multiple files" do
visit "/multiple/posts/new"
fill_in "Title", with: "A cool post"
attach_file "Documents", [path("hello.txt"), path("world.txt")]
click_button "Create"
expect(download_link("Document: hello.txt")... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/spec/refile/features/simple_form_spec.rb | spec/refile/features/simple_form_spec.rb | require "refile/test_app"
feature "simple form upload" do
scenario "renders a normal input" do
visit "/simple_form/posts/new"
attach_file "Document", path("hello.txt")
end
end
| ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/spec/refile/features/direct_upload_spec.rb | spec/refile/features/direct_upload_spec.rb | require "refile/test_app"
feature "Direct HTTP post file uploads", :js do
scenario "Successfully upload a file" do
visit "/direct/posts/new"
fill_in "Title", with: "A cool post"
attach_file "Document", path("hello.txt")
expect(page).to have_content("Upload started")
expect(page).to have_content(... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/spec/refile/features/presigned_upload_spec.rb | spec/refile/features/presigned_upload_spec.rb | require "refile/test_app"
feature "Direct HTTP post file uploads", :js do
scenario "Successfully upload a file" do
visit "/presigned/posts/new"
fill_in "Title", with: "A cool post"
attach_file "Document", path("hello.txt")
expect(page).to have_content("Presign start")
expect(page).to have_conten... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/lib/refile.rb | lib/refile.rb | require "uri"
require "fileutils"
require "tempfile"
require "logger"
require "mime/types"
module Refile
# @api private
class Error < StandardError; end
# @api private
class Invalid < Error; end
# @api private
class InvalidID < Invalid; end
# @api private
class InvalidMaxSize < Invalid; end
# @ap... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/lib/refile/download.rb | lib/refile/download.rb | require "open-uri"
require "forwardable"
require "cgi"
module Refile
# This class downloads a given URL and returns its IO, size, content type and
# original file name.
#
# Usage:
#
# download = Refile::Download.new('http://example.com/my/data.bin')
# download.io
# #=> #<StringIO:0x00007fdc... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/lib/refile/version.rb | lib/refile/version.rb | module Refile
VERSION = "0.7.0"
end
| ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/lib/refile/rails.rb | lib/refile/rails.rb | require "refile"
require "refile/rails/attachment_helper"
module Refile
# @api private
class Engine < Rails::Engine
initializer "refile.setup", before: :load_environment_config do
if RUBY_PLATFORM == "java"
# Work around a bug in JRuby, see: https://github.com/jruby/jruby/issues/2779
Enco... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/lib/refile/type.rb | lib/refile/type.rb | module Refile
# A type represents an alias for one or multiple content types.
# By adding types, you could simplify this:
#
# attachment :document, content_type: %w[text/plain application/pdf]
#
# To this:
#
# attachment :document, type: :document
#
# Simply define a new type like this:
#
... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/lib/refile/attachment_definition.rb | lib/refile/attachment_definition.rb | module Refile
# @api private
class AttachmentDefinition
attr_reader :record, :name, :cache, :store, :options, :type, :valid_content_types
attr_accessor :remove
def initialize(name, cache:, store:, raise_errors: true, type: nil, extension: nil, content_type: nil)
@name = name
@raise_errors =... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/lib/refile/file.rb | lib/refile/file.rb | module Refile
class File
# @return [Backend] the backend the file is stored in
attr_reader :backend
# @return [String] the id of the file
attr_reader :id
# @api private
def initialize(backend, id)
@backend = backend
@id = id
end
# Reads from the file.
#
# @see ht... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/lib/refile/app.rb | lib/refile/app.rb | require "json"
require "sinatra/base"
require "tempfile"
module Refile
# A Rack application which can be mounted or run on its own.
#
# @example mounted in Rails
# Rails.application.routes.draw do
# mount Refile::App.new, at: "attachments", as: :refile_app
# end
#
# @example as standalone app
... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/lib/refile/attachment.rb | lib/refile/attachment.rb | module Refile
module Attachment
# Macro which generates accessors for the given column which make it
# possible to upload and retrieve previously uploaded files through the
# generated accessors.
#
# The `raise_errors` option controls whether assigning an invalid file
# should immediately rais... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/lib/refile/backend_macros.rb | lib/refile/backend_macros.rb | module Refile
# Macros which make it easier to write secure backends.
#
# @api private
module BackendMacros
def verify_id(method)
mod = Module.new do
define_method(method) do |id|
id = self.class.decode_id(id)
if self.class.valid_id?(id)
super(id)
else... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/lib/refile/simple_form.rb | lib/refile/simple_form.rb | # make attachment_field behave like a normal input type so we get nice wrapper and labels
# <%= f.input :cover_image, as: :attachment, direct: true, presigned: true %>
module SimpleForm
module Inputs
class AttachmentInput < Base
def input(wrapper_options = nil)
refile_options = [:presigned, :direct,... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/lib/refile/file_double.rb | lib/refile/file_double.rb | module Refile
class FileDouble
attr_reader :original_filename, :content_type
def initialize(data, name = nil, content_type: nil)
@io = StringIO.new(data)
@original_filename = name
@content_type = content_type
end
extend Forwardable
def_delegators :@io, :read, :rewind, :size, :eo... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/lib/refile/signature.rb | lib/refile/signature.rb | module Refile
# A signature summarizes an HTTP request a client can make to upload a file
# to directly upload a file to a backend. This signature is usually generated
# by a backend's `presign` method.
class Signature
# @return [String] the name of the field that the file will be uploaded as.
attr_read... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/lib/refile/attacher.rb | lib/refile/attacher.rb | module Refile
# @api private
class Attacher
attr_reader :definition, :record, :errors
attr_accessor :remove
Presence = ->(val) { val if val != "" }
def initialize(definition, record)
@definition = definition
@record = record
@errors = []
@metadata = {}
end
def name... | ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
refile/refile | https://github.com/refile/refile/blob/c4ac577c6fdad92bc079a62a0e82888319daedc8/lib/refile/random_hasher.rb | lib/refile/random_hasher.rb | module Refile
# A file hasher which ignores the file contents and always returns a random string.
class RandomHasher
# Generate a random string
#
# @return [String]
def hash(_uploadable = nil)
SecureRandom.hex(30)
end
end
end
| ruby | MIT | c4ac577c6fdad92bc079a62a0e82888319daedc8 | 2026-01-04T15:55:25.004390Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.