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 |
|---|---|---|---|---|---|---|---|---|
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/test/dummy/config/initializers/wrap_parameters.rb | test/dummy/config/initializers/wrap_parameters.rb | # frozen_string_literal: true
# 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_co... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/test/dummy/config/initializers/inflections.rb | test/dummy/config/initializers/inflections.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
#... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/test/dummy/config/initializers/cookies_serializer.rb | test/dummy/config/initializers/cookies_serializer.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
Rails.application.config.action_dispatch.cookies_serializer = :json | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/test/dummy/config/initializers/assets.rb | test/dummy/config/initializers/assets.rb | # frozen_string_literal: true
Rails.application.config.assets.precompile += %w( ckeditor/* )
| ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/test/dummy/config/initializers/backtrace_silencers.rb | test/dummy/config/initializers/backtrace_silencers.rb | # frozen_string_literal: true
# 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... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/test/dummy/config/initializers/mime_types.rb | test/dummy/config/initializers/mime_types.rb | # frozen_string_literal: true
# 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
# Mime::Type.register_alias "text/html", :iphone
| ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/test/dummy/config/initializers/ckeditor.rb | test/dummy/config/initializers/ckeditor.rb | # frozen_string_literal: true
dir = File.join(Rails.root, "..", "..", "lib", "generators", "ckeditor", "templates")
# Load the CKEditor initializer from the codebase.
initializer = ERB.new(File.read(File.join(dir, "ckeditor.rb")))
options = { :orm => CKEDITOR_ORM }
eval initializer.result(binding)
# Also load the sp... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/test/dummy/config/environments/test.rb | test/dummy/config/environments/test.rb | # frozen_string_literal: true
Dummy::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
config.eager_load = false
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/test/dummy/config/environments/development.rb | test/dummy/config/environments/development.rb | # frozen_string_literal: true
Dummy::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/test/dummy/config/environments/production.rb | test/dummy/config/environments/production.rb | # frozen_string_literal: true
Dummy::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
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local ... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/test/orm/active_record.rb | test/orm/active_record.rb | # frozen_string_literal: true
def activerecord_below?(version)
ActiveRecord.version.release < Gem::Version.new(version)
end
if activerecord_below?('5.2.0')
ActiveRecord::Migrator.migrate('test/dummy/db/migrate')
elsif activerecord_below?('7.0.0')
schema_migration = ActiveRecord::Base.connection.schema_migration... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/test/orm/mongoid.rb | test/orm/mongoid.rb | # frozen_string_literal: true
class ActiveSupport::TestCase
setup do
Post.delete_all
Ckeditor::Asset.delete_all
end
end
| ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/test/functional/posts_controller_test.rb | test/functional/posts_controller_test.rb | # frozen_string_literal: true
require 'test_helper'
class PostsControllerTest < ActionController::TestCase
def setup
@post = Post.create!(title: 'test', content: 'content', info: 'info')
end
def teardown
@post.destroy rescue nil
end
test 'include javascripts' do
get :index
assert_select '... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/ckeditor.rb | lib/ckeditor.rb | # frozen_string_literal: true
require 'orm_adapter'
require 'pathname'
module Ckeditor
autoload :Utils, 'ckeditor/utils'
autoload :Http, 'ckeditor/http'
autoload :TextArea, 'ckeditor/text_area'
autoload :Paginatable, 'ckeditor/paginatable'
autoload :AssetResponse, 'ckeditor/asset_response'
module Helpers... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/ckeditor/version.rb | lib/ckeditor/version.rb | # frozen_string_literal: true
module Ckeditor
module Version
GEM = '5.1.3'
EDITOR = '4.22.1'
end
end
| ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/ckeditor/rails.rb | lib/ckeditor/rails.rb | # frozen_string_literal: true
module Ckeditor
class Engine < ::Rails::Engine
isolate_namespace Ckeditor
initializer 'ckeditor.assets_precompile', group: :all do |app|
app.config.assets.precompile += Ckeditor.assets
end
initializer 'ckeditor.helpers' do
ActiveSupport.on_load(:action_cont... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/ckeditor/utils.rb | lib/ckeditor/utils.rb | # frozen_string_literal: true
require 'active_support/json/encoding'
module Ckeditor
module Utils
autoload :JavascriptCode, 'ckeditor/utils/javascript_code'
class << self
def escape_single_quotes(str)
str.gsub('\\', '\0\0').gsub('</', '<\/').gsub(/\r\n|\n|\r/, '\\n').gsub(/["']/) { |m| "\\#{m... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/ckeditor/text_area.rb | lib/ckeditor/text_area.rb | # frozen_string_literal: true
require 'active_support'
require 'action_view/helpers/tag_helper'
require 'action_view/helpers/form_tag_helper'
require 'action_view/helpers/javascript_helper'
module Ckeditor
class TextArea
include ActionView::Helpers::TagHelper
include ActionView::Helpers::FormTagHelper
i... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/ckeditor/asset_response.rb | lib/ckeditor/asset_response.rb | # frozen_string_literal: true
require 'action_view/helpers/tag_helper'
require 'action_view/helpers/javascript_helper'
module Ckeditor
class AssetResponse
include ActionView::Helpers::TagHelper
include ActionView::Helpers::JavaScriptHelper
FUNCTION = 'window.parent.CKEDITOR.tools.callFunction'
JSON... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/ckeditor/http.rb | lib/ckeditor/http.rb | # frozen_string_literal: true
require 'digest/sha1'
module Ckeditor
module Http
# Create tempfile from hash
class UploadedFile
attr_accessor :original_filename, :content_type, :tempfile, :headers
def initialize(hash)
@original_filename = hash[:filename]
@content_type = hash... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/ckeditor/paginatable.rb | lib/ckeditor/paginatable.rb | # frozen_string_literal: true
module Ckeditor
# Simple paginate relation
class Paginatable
attr_reader :limit_value, :offset_value
def initialize(scope, options = {})
@scope = scope
@limit_value = (options[:limit] || Ckeditor.default_per_page).to_i
end
def page(num = 1)
@offset_... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/ckeditor/helpers/view_helper.rb | lib/ckeditor/helpers/view_helper.rb | # frozen_string_literal: true
module Ckeditor
module Helpers
module ViewHelper
def cktext_area_tag(name, content = nil, options = {})
TextArea.new(self, options).render_tag(name, content)
end
end
end
end
| ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/ckeditor/helpers/form_helper.rb | lib/ckeditor/helpers/form_helper.rb | # frozen_string_literal: true
module Ckeditor
module Helpers
module FormHelper
def cktext_area(object_name, method, options = {})
TextArea.new(self, options).render_instance_tag(object_name, method)
end
end
end
end
| ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/ckeditor/helpers/controllers.rb | lib/ckeditor/helpers/controllers.rb | # frozen_string_literal: true
module Ckeditor
module Helpers
module Controllers
protected
def ckeditor_current_user
instance_exec(&Ckeditor.current_user_method)
end
def ckeditor_authorize!
instance_exec(&Ckeditor.authorize_with)
end
def ckeditor_pictures_sco... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/ckeditor/helpers/form_builder.rb | lib/ckeditor/helpers/form_builder.rb | # frozen_string_literal: true
module Ckeditor
module Helpers
module FormBuilder
def cktext_area(method, options = {})
@template.cktext_area(@object_name, method, objectify_options(options))
end
end
end
end
| ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/ckeditor/hooks/cancan.rb | lib/ckeditor/hooks/cancan.rb | # frozen_string_literal: true
require 'cancan'
module Ckeditor
module Hooks
# This adapter is for the CanCanCan[https://github.com/CanCanCommunity/cancancan] authorization library.
# You can create another adapter for different authorization behavior, just be certain it
# responds to each of the public ... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/ckeditor/hooks/action_policy.rb | lib/ckeditor/hooks/action_policy.rb | # frozen_string_literal: true
require 'action_policy'
module Ckeditor
module Hooks
# This adapter is for the Action Policy[https://github.com/palkan/action_policy] authorization library.
# You can create another adapter for different authorization behavior, just be certain it
# responds to each of the p... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/ckeditor/hooks/pundit.rb | lib/ckeditor/hooks/pundit.rb | # frozen_string_literal: true
require 'pundit'
module Ckeditor
module Hooks
# This adapter is for the Pundit[https://github.com/elabs/pundit] authorization library.
# You can create another adapter for different authorization behavior, just be certain it
# responds to each of the public methods here.
... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/ckeditor/hooks/simple_form.rb | lib/ckeditor/hooks/simple_form.rb | # frozen_string_literal: true
require 'simple_form'
module Ckeditor
module Hooks
module SimpleForm
class CkeditorInput < ::SimpleForm::Inputs::Base
def input(_wrapper_options = nil)
@builder.cktext_area(attribute_name, input_html_options)
end
end
end
end
end
::Simple... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/ckeditor/hooks/formtastic.rb | lib/ckeditor/hooks/formtastic.rb | # frozen_string_literal: true
require 'formtastic'
class CkeditorInput
include ::Formtastic::Inputs::Base
def to_html
input_wrapping do
label_html <<
builder.cktext_area(method, input_html_options)
end
end
end
| ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/ckeditor/utils/javascript_code.rb | lib/ckeditor/utils/javascript_code.rb | # frozen_string_literal: true
module Ckeditor
module Utils
class JavascriptCode < String
def as_json(_options = nil)
self
end
def encode_json(_encoder)
self
end
end
end
end
| ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/ckeditor/backend/paperclip.rb | lib/ckeditor/backend/paperclip.rb | # frozen_string_literal: true
module Ckeditor
module Backend
module Paperclip
def self.included(base)
base.send(:include, InstanceMethods)
base.send(:extend, ClassMethods)
end
module ClassMethods
def self.extended(base)
base.class_eval do
delegate ... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/ckeditor/backend/active_storage.rb | lib/ckeditor/backend/active_storage.rb | # frozen_string_literal: true
module Ckeditor
module Backend
module ActiveStorage
def self.included(base)
base.send(:include, Rails.application.routes.url_helpers)
base.send(:include, InstanceMethods)
base.send(:extend, ClassMethods)
end
module ClassMethods
def ... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/ckeditor/backend/shrine.rb | lib/ckeditor/backend/shrine.rb | # frozen_string_literal: true
module Ckeditor
module Backend
module Shrine
def self.included(base)
base.send(:include, InstanceMethods)
end
module InstanceMethods
def data=(value)
self.attachment = value
end
def url
attachment&.url
e... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/ckeditor/backend/carrierwave.rb | lib/ckeditor/backend/carrierwave.rb | # frozen_string_literal: true
require 'mini_magick'
module Ckeditor
module Backend
module CarrierWave
def self.included(base)
base.send(:include, InstanceMethods)
base.send(:extend, ClassMethods)
end
module ClassMethods
def self.extended(base)
base.class_eval... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/ckeditor/backend/dragonfly.rb | lib/ckeditor/backend/dragonfly.rb | # frozen_string_literal: true
module Ckeditor
module Backend
module Dragonfly
FORMATS = %w[bz2 gz lzma xz].freeze
def self.included(base)
base.send(:extend, ::Dragonfly::Model)
base.send(:extend, ::Dragonfly::Model::Validations)
base.send(:extend, ClassMethods)
base.s... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/ckeditor/orm/active_record.rb | lib/ckeditor/orm/active_record.rb | # frozen_string_literal: true
require 'ckeditor/orm/base'
module Ckeditor
module Orm
module ActiveRecord
module AssetBase
def self.included(base)
base.send(:include, Base::AssetBase::InstanceMethods)
base.send(:extend, ClassMethods)
end
module ClassMethods
... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/ckeditor/orm/mongoid.rb | lib/ckeditor/orm/mongoid.rb | # frozen_string_literal: true
require 'orm_adapter/adapters/mongoid'
require 'ckeditor/orm/base'
module Ckeditor
module Orm
module Mongoid
module AssetBase
def self.included(base)
base.send(:include, ::Mongoid::Document)
base.send(:include, ::Mongoid::Timestamps)
base... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/ckeditor/orm/base.rb | lib/ckeditor/orm/base.rb | # frozen_string_literal: true
module Ckeditor
module Orm
module Base
module AssetBase
module InstanceMethods
def filename
data_file_name
end
def size
data_file_size
end
def respond_to_dimensions?
respond_to?(:wi... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/action_policy_generator.rb | lib/generators/ckeditor/action_policy_generator.rb | # frozen_string_literal: true
require 'rails/generators'
module Ckeditor
module Generators
class ActionPolicyGenerator < Rails::Generators::Base
desc 'Generates policy files for Action Policy'
def self.source_root
@source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'template... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/install_generator.rb | lib/generators/ckeditor/install_generator.rb | # frozen_string_literal: true
require 'rails/generators'
require 'rails/generators/migration'
module Ckeditor
module Generators
class InstallGenerator < Rails::Generators::Base
include Rails::Generators::Migration
desc 'Generates migration for Asset (Picture, AttachmentFile) models'
# ORM co... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/pundit_policy_generator.rb | lib/generators/ckeditor/pundit_policy_generator.rb | # frozen_string_literal: true
require 'rails/generators'
module Ckeditor
module Generators
class PunditPolicyGenerator < Rails::Generators::Base
desc 'Generates policy files for Pundit'
def self.source_root
@source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/ckeditor.rb | lib/generators/ckeditor/templates/ckeditor.rb | # frozen_string_literal: true
# Use this hook to configure ckeditor
Ckeditor.setup do |config|
# ==> ORM configuration
# Load and configure the ORM. Supports :active_record (default), :mongo_mapper and
# :mongoid (bson_ext recommended) by default. Other ORMs may be
# available as additional gems.
require 'ck... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/base/shrine/initializer.rb | lib/generators/ckeditor/templates/base/shrine/initializer.rb | # frozen_string_literal: true
require 'shrine'
require 'shrine/storage/file_system'
require 'ckeditor/backend/shrine'
# Choose your favorite image processor
require 'image_processing/mini_magick'
SHRINE_PICTURE_PROCESSOR = ImageProcessing::MiniMagick
Shrine.storages = {
cache: Shrine::Storage::FileSystem.new('publ... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/base/shrine/uploaders/ckeditor_attachment_uploader.rb | lib/generators/ckeditor/templates/base/shrine/uploaders/ckeditor_attachment_uploader.rb | # frozen_string_literal: true
class CkeditorAttachmentUploader < Shrine
plugin :validation_helpers
Attacher.validate do
validate_max_size 5 * 1024 * 1024 # file size must not be greater than 5 MB
validate_min_size 1024 # file size must not be less than 1 KB
end
end
| ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/base/carrierwave/uploaders/ckeditor_attachment_file_uploader.rb | lib/generators/ckeditor/templates/base/carrierwave/uploaders/ckeditor_attachment_file_uploader.rb | # frozen_string_literal: true
require 'carrierwave'
class CkeditorAttachmentFileUploader < CarrierWave::Uploader::Base
include Ckeditor::Backend::CarrierWave
# Include RMagick or ImageScience support:
# include CarrierWave::RMagick
# include CarrierWave::MiniMagick
# include CarrierWave::ImageScience
# ... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/base/carrierwave/uploaders/ckeditor_picture_uploader.rb | lib/generators/ckeditor/templates/base/carrierwave/uploaders/ckeditor_picture_uploader.rb | # frozen_string_literal: true
class CkeditorPictureUploader < CarrierWave::Uploader::Base
include Ckeditor::Backend::CarrierWave
# Include RMagick or ImageScience support:
# include CarrierWave::RMagick
include CarrierWave::MiniMagick
# include CarrierWave::ImageScience
# Choose what kind of storage to u... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/base/dragonfly/initializer.rb | lib/generators/ckeditor/templates/base/dragonfly/initializer.rb | # frozen_string_literal: true
# Load Dragonfly if it isn't loaded already.
require 'dragonfly'
Dragonfly.app(:ckeditor).configure do
plugin :imagemagick
secret '<%= SecureRandom.hex(32) %>'
# Store files in public/uploads/ckeditor. This is not
# mandatory and the files don't even have to be stored under
# ... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/mongoid/shrine/ckeditor/picture.rb | lib/generators/ckeditor/templates/mongoid/shrine/ckeditor/picture.rb | # frozen_string_literal: true
module Ckeditor
class PictureUploader < Shrine
plugin :determine_mime_type
plugin :validation_helpers
plugin :processing
plugin :versions
Attacher.validate do
validate_mime_type_inclusion %w[image/jpeg image/gif image/png]
validate_max_size 2.megabytes
... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/mongoid/shrine/ckeditor/attachment_file.rb | lib/generators/ckeditor/templates/mongoid/shrine/ckeditor/attachment_file.rb | # frozen_string_literal: true
module Ckeditor
class AttachmentFileUploader < Shrine
plugin :validation_helpers
Attacher.validate do
validate_max_size 100.megabytes
end
end
class AttachmentFile < Ckeditor::Asset
include AttachmentFileUploader.attachment(:data)
validates :data, presenc... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/mongoid/shrine/ckeditor/asset.rb | lib/generators/ckeditor/templates/mongoid/shrine/ckeditor/asset.rb | # frozen_string_literal: true
class Ckeditor::Asset
include Ckeditor::Orm::Mongoid::AssetBase
include Ckeditor::Backend::Shrine
field :data_data, type: Hash
end
| ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/mongoid/carrierwave/ckeditor/picture.rb | lib/generators/ckeditor/templates/mongoid/carrierwave/ckeditor/picture.rb | # frozen_string_literal: true
class Ckeditor::Picture < Ckeditor::Asset
mount_uploader :data, CkeditorPictureUploader, mount_on: :data_file_name
def url_content
url(:content)
end
end
| ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/mongoid/carrierwave/ckeditor/attachment_file.rb | lib/generators/ckeditor/templates/mongoid/carrierwave/ckeditor/attachment_file.rb | # frozen_string_literal: true
class Ckeditor::AttachmentFile < Ckeditor::Asset
mount_uploader :data, CkeditorAttachmentFileUploader, mount_on: :data_file_name
def url_thumb
@url_thumb ||= Ckeditor::Utils.filethumb(filename)
end
end
| ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/mongoid/carrierwave/ckeditor/asset.rb | lib/generators/ckeditor/templates/mongoid/carrierwave/ckeditor/asset.rb | # frozen_string_literal: true
class Ckeditor::Asset
include Ckeditor::Orm::Mongoid::AssetBase
delegate :url, :current_path, :content_type, to: :data
validates :data, presence: true
end
| ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/mongoid/paperclip/ckeditor/picture.rb | lib/generators/ckeditor/templates/mongoid/paperclip/ckeditor/picture.rb | # frozen_string_literal: true
class Ckeditor::Picture < Ckeditor::Asset
has_mongoid_attached_file :data, {
url: '/ckeditor_assets/pictures/:id/:style_:basename.:extension',
path: ':rails_root/public/ckeditor_assets/pictures/:id/:style_:basename.:extension',
styles: { content: '800>', thumb: '118x100#' }
... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/mongoid/paperclip/ckeditor/attachment_file.rb | lib/generators/ckeditor/templates/mongoid/paperclip/ckeditor/attachment_file.rb | # frozen_string_literal: true
class Ckeditor::AttachmentFile < Ckeditor::Asset
has_mongoid_attached_file :data,
url: '/ckeditor_assets/attachments/:id/:filename',
path: ':rails_root/public/ckeditor_assets/attachments/:id/:filename'
validates_attachment_prese... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/mongoid/paperclip/ckeditor/asset.rb | lib/generators/ckeditor/templates/mongoid/paperclip/ckeditor/asset.rb | # frozen_string_literal: true
class Ckeditor::Asset
include Ckeditor::Orm::Mongoid::AssetBase
include Mongoid::Paperclip
include Ckeditor::Backend::Paperclip
end
| ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/action_policy/attachment_file_policy.rb | lib/generators/ckeditor/templates/action_policy/attachment_file_policy.rb | # frozen_string_literal: true
class Ckeditor::AttachmentFilePolicy < ApplicationPolicy
# See https://actionpolicy.evilmartians.io/#/writing_policies
#
def index?
user.present?
end
def create?
user.present?
end
def destroy?
user.present?
end
end
| ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/action_policy/picture_policy.rb | lib/generators/ckeditor/templates/action_policy/picture_policy.rb | # frozen_string_literal: true
class Ckeditor::PicturePolicy < ApplicationPolicy
# See https://actionpolicy.evilmartians.io/#/writing_policies
#
def index?
user.present?
end
def create?
user.present?
end
def destroy?
user.present?
end
end
| ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/active_record/shrine/create_ckeditor_assets.rb | lib/generators/ckeditor/templates/active_record/shrine/create_ckeditor_assets.rb | # frozen_string_literal: true
class CreateCkeditorAssets < ActiveRecord::Migration[6.1]
def up
create_table :ckeditor_assets do |t|
t.integer :data_size
t.string :type, limit: 30
# Shrine column
t.text :attachment_data
# Uncomment these to save image dimensions, if your need t... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/active_record/shrine/ckeditor/picture.rb | lib/generators/ckeditor/templates/active_record/shrine/ckeditor/picture.rb | # frozen_string_literal: true
class Ckeditor::Picture < Ckeditor::Asset
def url_content
attachment&.url
end
def url_thumb
attachment&.url
end
end
| ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/active_record/shrine/ckeditor/attachment_file.rb | lib/generators/ckeditor/templates/active_record/shrine/ckeditor/attachment_file.rb | # frozen_string_literal: true
class Ckeditor::AttachmentFile < Ckeditor::Asset
def url_thumb
Ckeditor::Utils.filethumb(filename)
end
end
| ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/active_record/shrine/ckeditor/asset.rb | lib/generators/ckeditor/templates/active_record/shrine/ckeditor/asset.rb | # frozen_string_literal: true
class Ckeditor::Asset < ApplicationRecord
include Ckeditor::Orm::ActiveRecord::AssetBase
include Ckeditor::Backend::Shrine
include CkeditorAttachmentUploader::Attachment(:attachment)
validates :attachment_data, presence: true
end
| ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/active_record/carrierwave/create_ckeditor_assets.rb | lib/generators/ckeditor/templates/active_record/carrierwave/create_ckeditor_assets.rb | # frozen_string_literal: true
class CreateCkeditorAssets < ActiveRecord::Migration[6.1]
def up
create_table :ckeditor_assets do |t|
t.string :data_file_name, null: false
t.string :data_content_type
t.integer :data_file_size
t.string :type, limit: 30
# Uncomment it to save images... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/active_record/carrierwave/ckeditor/picture.rb | lib/generators/ckeditor/templates/active_record/carrierwave/ckeditor/picture.rb | # frozen_string_literal: true
class Ckeditor::Picture < Ckeditor::Asset
mount_uploader :data, CkeditorPictureUploader, mount_on: :data_file_name
def url_content
url(:content)
end
end
| ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/active_record/carrierwave/ckeditor/attachment_file.rb | lib/generators/ckeditor/templates/active_record/carrierwave/ckeditor/attachment_file.rb | # frozen_string_literal: true
class Ckeditor::AttachmentFile < Ckeditor::Asset
mount_uploader :data, CkeditorAttachmentFileUploader, mount_on: :data_file_name
def url_thumb
@url_thumb ||= Ckeditor::Utils.filethumb(filename)
end
end
| ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/active_record/carrierwave/ckeditor/asset.rb | lib/generators/ckeditor/templates/active_record/carrierwave/ckeditor/asset.rb | # frozen_string_literal: true
class Ckeditor::Asset < ApplicationRecord
include Ckeditor::Orm::ActiveRecord::AssetBase
delegate :url, :current_path, :content_type, to: :data
validates :data, presence: true
end
| ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/active_record/active_storage/create_ckeditor_assets.rb | lib/generators/ckeditor/templates/active_record/active_storage/create_ckeditor_assets.rb | # frozen_string_literal: true
class CreateCkeditorAssets < ActiveRecord::Migration[6.1]
def up
create_table :ckeditor_assets do |t|
t.string :data_file_name, null: false
t.string :data_content_type
t.integer :data_file_size
t.string :data_fingerprint
t.string :type, limit: 30
... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/active_record/active_storage/ckeditor/picture.rb | lib/generators/ckeditor/templates/active_record/active_storage/ckeditor/picture.rb | # frozen_string_literal: true
class Ckeditor::Picture < Ckeditor::Asset
# for validation, see https://github.com/igorkasyanchuk/active_storage_validations
def url_content
rails_representation_url(storage_data.variant(resize: '800>').processed, only_path: true)
end
def url_thumb
rails_representation_u... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/active_record/active_storage/ckeditor/attachment_file.rb | lib/generators/ckeditor/templates/active_record/active_storage/ckeditor/attachment_file.rb | # frozen_string_literal: true
class Ckeditor::AttachmentFile < Ckeditor::Asset
# for validation, see https://github.com/igorkasyanchuk/active_storage_validations
def url_thumb
@url_thumb ||= Ckeditor::Utils.filethumb(filename)
end
end
| ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/active_record/active_storage/ckeditor/asset.rb | lib/generators/ckeditor/templates/active_record/active_storage/ckeditor/asset.rb | # frozen_string_literal: true
class Ckeditor::Asset < ApplicationRecord
include Ckeditor::Orm::ActiveRecord::AssetBase
include Ckeditor::Backend::ActiveStorage
attr_accessor :data
has_one_attached :storage_data
end
| ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/active_record/paperclip/create_ckeditor_assets.rb | lib/generators/ckeditor/templates/active_record/paperclip/create_ckeditor_assets.rb | # frozen_string_literal: true
class CreateCkeditorAssets < ActiveRecord::Migration[6.1]
def up
create_table :ckeditor_assets do |t|
t.string :data_file_name, null: false
t.string :data_content_type
t.integer :data_file_size
t.string :data_fingerprint
t.string :type, limit: 30
... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/active_record/paperclip/ckeditor/picture.rb | lib/generators/ckeditor/templates/active_record/paperclip/ckeditor/picture.rb | # frozen_string_literal: true
class Ckeditor::Picture < Ckeditor::Asset
has_attached_file :data,
url: '/ckeditor_assets/pictures/:id/:style_:basename.:extension',
path: ':rails_root/public/ckeditor_assets/pictures/:id/:style_:basename.:extension',
styles: {... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/active_record/paperclip/ckeditor/attachment_file.rb | lib/generators/ckeditor/templates/active_record/paperclip/ckeditor/attachment_file.rb | # frozen_string_literal: true
class Ckeditor::AttachmentFile < Ckeditor::Asset
has_attached_file :data,
url: '/ckeditor_assets/attachments/:id/:filename',
path: ':rails_root/public/ckeditor_assets/attachments/:id/:filename'
validates_attachment_presence :data
validates_at... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/active_record/paperclip/ckeditor/asset.rb | lib/generators/ckeditor/templates/active_record/paperclip/ckeditor/asset.rb | # frozen_string_literal: true
class Ckeditor::Asset < ApplicationRecord
include Ckeditor::Orm::ActiveRecord::AssetBase
include Ckeditor::Backend::Paperclip
end
| ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/active_record/dragonfly/create_ckeditor_assets.rb | lib/generators/ckeditor/templates/active_record/dragonfly/create_ckeditor_assets.rb | # frozen_string_literal: true
class CreateCkeditorAssets < ActiveRecord::Migration[6.1]
def up
create_table :ckeditor_assets do |t|
t.string :data_uid, null: false
t.string :data_name, null: false
t.string :data_mime_type
t.integer :data_size
t.string :type, limit: 30
# U... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/active_record/dragonfly/ckeditor/picture.rb | lib/generators/ckeditor/templates/active_record/dragonfly/ckeditor/picture.rb | # frozen_string_literal: true
class Ckeditor::Picture < Ckeditor::Asset
validates_property :format, of: :data, in: image_file_types unless image_file_types.empty?
validates_property :image?, of: :data, as: true, message: :invalid
def url_content
data.thumb('800x800>').url
end
def url_thumb
data.thu... | ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/active_record/dragonfly/ckeditor/attachment_file.rb | lib/generators/ckeditor/templates/active_record/dragonfly/ckeditor/attachment_file.rb | # frozen_string_literal: true
class Ckeditor::AttachmentFile < Ckeditor::Asset
validates_property :ext, of: :data, in: attachment_file_types unless attachment_file_types.empty?
def url_thumb
Ckeditor::Utils.filethumb(filename)
end
end
| ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/active_record/dragonfly/ckeditor/asset.rb | lib/generators/ckeditor/templates/active_record/dragonfly/ckeditor/asset.rb | # frozen_string_literal: true
class Ckeditor::Asset < ApplicationRecord
include Ckeditor::Orm::ActiveRecord::AssetBase
include Ckeditor::Backend::Dragonfly
dragonfly_accessor :data, app: :ckeditor
validates :data, presence: true
end
| ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/pundit_policy/attachment_file_policy.rb | lib/generators/ckeditor/templates/pundit_policy/attachment_file_policy.rb | # frozen_string_literal: true
class Ckeditor::AttachmentFilePolicy
attr_reader :user, :attachment
def initialize(user, attachment)
@user = user
@attachment = attachment
end
def index?
user.present?
end
def create?
user.present?
end
def destroy?
user.present?
end
end
| ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/lib/generators/ckeditor/templates/pundit_policy/picture_policy.rb | lib/generators/ckeditor/templates/pundit_policy/picture_policy.rb | # frozen_string_literal: true
class Ckeditor::PicturePolicy
attr_reader :user, :picture
def initialize(user, picture)
@user = user
@picture = picture
end
def index?
user.present?
end
def create?
user.present?
end
def destroy?
user.present?
end
end
| ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
galetahub/ckeditor | https://github.com/galetahub/ckeditor/blob/f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570/config/routes.rb | config/routes.rb | # frozen_string_literal: true
Ckeditor::Engine.routes.draw do
resources :pictures, only: %i[index create destroy]
resources :attachment_files, only: %i[index create destroy]
end
| ruby | MIT | f6f8e2b2f61a8315ea0994db74d8e4a1ed6a2570 | 2026-01-04T15:56:58.833789Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/jobs/pay/customer_sync_job.rb | app/jobs/pay/customer_sync_job.rb | module Pay
class CustomerSyncJob < ApplicationJob
def perform(pay_customer_id)
Pay::Customer.find(pay_customer_id).update_api_record
rescue ActiveRecord::RecordNotFound
Rails.logger.info "Couldn't find a Pay::Customer with ID = #{pay_customer_id}"
end
end
end
| ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/jobs/pay/application_job.rb | app/jobs/pay/application_job.rb | module Pay
class ApplicationJob < ActiveJob::Base
end
end
| ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/helpers/pay/currency_helper.rb | app/helpers/pay/currency_helper.rb | module Pay
module CurrencyHelper
def pay_amount_to_currency(object, **options)
Pay::Currency.format(object.amount, **options.merge(currency: object.currency))
end
end
end
| ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/controllers/pay/payments_controller.rb | app/controllers/pay/payments_controller.rb | module Pay
class PaymentsController < ApplicationController
layout "pay/application"
before_action :set_redirect_to
def show
@payment = Payment.from_id(params[:id])
rescue ::Stripe::StripeError => e
redirect_to root_path, alert: e.message
end
private
# Ensure the back param... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/controllers/pay/application_controller.rb | app/controllers/pay/application_controller.rb | module Pay
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
end
end
| ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/controllers/pay/webhooks/paddle_billing_controller.rb | app/controllers/pay/webhooks/paddle_billing_controller.rb | module Pay
module Webhooks
class PaddleBillingController < ActionController::API
def create
if valid_signature?(request.headers["Paddle-Signature"])
queue_event(verify_params.as_json)
head :ok
else
head :bad_request
end
rescue Pay::PaddleBilling::E... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/controllers/pay/webhooks/braintree_controller.rb | app/controllers/pay/webhooks/braintree_controller.rb | module Pay
module Webhooks
class BraintreeController < ActionController::API
def create
queue_event(verified_event)
head :ok
rescue ::Braintree::InvalidSignature
head :bad_request
end
private
def queue_event(event)
return unless Pay::Webhooks.delegat... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/controllers/pay/webhooks/stripe_controller.rb | app/controllers/pay/webhooks/stripe_controller.rb | module Pay
module Webhooks
class StripeController < ActionController::API
def create
event = verified_event
queue_event(event) if event.livemode || Pay::Stripe.webhook_receive_test_events
head :ok
rescue ::Stripe::SignatureVerificationError => e
log_error(e)
hea... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/controllers/pay/webhooks/paddle_classic_controller.rb | app/controllers/pay/webhooks/paddle_classic_controller.rb | module Pay
module Webhooks
class PaddleClassicController < ActionController::API
def create
queue_event(verified_event)
head :ok
rescue Pay::PaddleClassic::Error
head :bad_request
end
private
def queue_event(event)
return unless Pay::Webhooks.delegat... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/controllers/pay/webhooks/lemon_squeezy_controller.rb | app/controllers/pay/webhooks/lemon_squeezy_controller.rb | module Pay
module Webhooks
class LemonSqueezyController < ActionController::API
def create
if valid_signature?(request.headers["X-Signature"])
queue_event(verify_params.as_json)
head :ok
else
head :bad_request
end
rescue Pay::LemonSqueezy::Error
... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/concerns/pay/routing.rb | app/models/concerns/pay/routing.rb | module Pay
module Routing
extend ActiveSupport::Concern
included do
include Rails.application.routes.url_helpers
end
def default_url_options
Rails.application.config.action_mailer.default_url_options || {}
end
end
end
| ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/subscription.rb | app/models/pay/subscription.rb | module Pay
class Subscription < Pay::ApplicationRecord
STATUSES = %w[incomplete incomplete_expired trialing active past_due canceled unpaid paused]
# Associations
belongs_to :customer
belongs_to :payment_method, optional: true, primary_key: :processor_id
has_many :charges
# Scopes
scope ... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/customer.rb | app/models/pay/customer.rb | module Pay
class Customer < Pay::ApplicationRecord
belongs_to :owner, polymorphic: true
has_many :charges, dependent: :destroy
has_many :subscriptions, dependent: :destroy
has_many :payment_methods, dependent: :destroy
has_one :default_payment_method, -> { where(default: true) }, class_name: "Pay:... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/merchant.rb | app/models/pay/merchant.rb | module Pay
class Merchant < Pay::ApplicationRecord
belongs_to :owner, polymorphic: true
validates :processor, presence: true
store_accessor :data, :onboarding_complete
def onboarding_complete?
ActiveModel::Type::Boolean.new.cast(data&.fetch("onboarding_complete")) || false
end
end
end
... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/payment_method.rb | app/models/pay/payment_method.rb | module Pay
class PaymentMethod < Pay::ApplicationRecord
belongs_to :customer
delegate :owner, to: :customer
store_accessor :data, :brand # Visa, Mastercard, Discover, PayPal
store_accessor :data, :last4
store_accessor :data, :exp_month
store_accessor :data, :exp_year
store_accessor :data... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/application_record.rb | app/models/pay/application_record.rb | module Pay
class ApplicationRecord < Pay.model_parent_class.constantize
self.abstract_class = true
self.table_name_prefix = "pay_"
end
end
| ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/charge.rb | app/models/pay/charge.rb | module Pay
class Charge < Pay::ApplicationRecord
# Associations
belongs_to :customer
belongs_to :subscription, optional: true
# Scopes
scope :sorted, -> { order(created_at: :desc) }
scope :with_active_customer, -> { joins(:customer).merge(Customer.active) }
scope :with_deleted_customer, -... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
pay-rails/pay | https://github.com/pay-rails/pay/blob/98eb2a4f8556b111e551a7990522bb6a46be65f1/app/models/pay/webhook.rb | app/models/pay/webhook.rb | module Pay
class Webhook < Pay::ApplicationRecord
validates :processor, presence: true
validates :event_type, presence: true
validates :event, presence: true
def process!
Pay::Webhooks.instrument type: "#{processor}.#{event_type}", event: rehydrated_event
# Remove after successfully proc... | ruby | MIT | 98eb2a4f8556b111e551a7990522bb6a46be65f1 | 2026-01-04T15:57:25.277088Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.