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 |
|---|---|---|---|---|---|---|---|---|
scambra/devise_invitable | https://github.com/scambra/devise_invitable/blob/de18ce349314485890754d6c5261ce48ae97b424/test/rails_app/config/initializers/session_store.rb | test/rails_app/config/initializers/session_store.rb | # Be sure to restart your server when you modify this file.
RailsApp::Application.config.session_store :cookie_store, key: '_test_app_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rake ... | ruby | MIT | de18ce349314485890754d6c5261ce48ae97b424 | 2026-01-04T15:53:35.686384Z | false |
scambra/devise_invitable | https://github.com/scambra/devise_invitable/blob/de18ce349314485890754d6c5261ce48ae97b424/test/rails_app/config/initializers/devise.rb | test/rails_app/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.
Devise.setup do |config|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render invalid all existing
# confirmat... | ruby | MIT | de18ce349314485890754d6c5261ce48ae97b424 | 2026-01-04T15:53:35.686384Z | false |
scambra/devise_invitable | https://github.com/scambra/devise_invitable/blob/de18ce349314485890754d6c5261ce48ae97b424/test/rails_app/config/initializers/wrap_parameters.rb | test/rails_app/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(... | ruby | MIT | de18ce349314485890754d6c5261ce48ae97b424 | 2026-01-04T15:53:35.686384Z | false |
scambra/devise_invitable | https://github.com/scambra/devise_invitable/blob/de18ce349314485890754d6c5261ce48ae97b424/test/rails_app/config/initializers/inflections.rb | test/rails_app/config/initializers/inflections.rb | # 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'
# inflect.irregular 'person', ... | ruby | MIT | de18ce349314485890754d6c5261ce48ae97b424 | 2026-01-04T15:53:35.686384Z | false |
scambra/devise_invitable | https://github.com/scambra/devise_invitable/blob/de18ce349314485890754d6c5261ce48ae97b424/test/rails_app/config/initializers/backtrace_silencers.rb | test/rails_app/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 | de18ce349314485890754d6c5261ce48ae97b424 | 2026-01-04T15:53:35.686384Z | false |
scambra/devise_invitable | https://github.com/scambra/devise_invitable/blob/de18ce349314485890754d6c5261ce48ae97b424/test/rails_app/config/initializers/mime_types.rb | test/rails_app/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
# Mime::Type.register_alias "text/html", :iphone
| ruby | MIT | de18ce349314485890754d6c5261ce48ae97b424 | 2026-01-04T15:53:35.686384Z | false |
scambra/devise_invitable | https://github.com/scambra/devise_invitable/blob/de18ce349314485890754d6c5261ce48ae97b424/test/rails_app/config/initializers/secret_token.rb | test/rails_app/config/initializers/secret_token.rb | # Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attac... | ruby | MIT | de18ce349314485890754d6c5261ce48ae97b424 | 2026-01-04T15:53:35.686384Z | false |
scambra/devise_invitable | https://github.com/scambra/devise_invitable/blob/de18ce349314485890754d6c5261ce48ae97b424/test/rails_app/config/environments/test.rb | test/rails_app/config/environments/test.rb | RailsApp::Application.configure do
# Settings specified here will take precedence over those in config/environment.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... | ruby | MIT | de18ce349314485890754d6c5261ce48ae97b424 | 2026-01-04T15:53:35.686384Z | false |
scambra/devise_invitable | https://github.com/scambra/devise_invitable/blob/de18ce349314485890754d6c5261ce48ae97b424/test/rails_app/config/environments/development.rb | test/rails_app/config/environments/development.rb | RailsApp::Application.configure do
# Settings specified here will take precedence over those in config/environment.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't have to restart the webs... | ruby | MIT | de18ce349314485890754d6c5261ce48ae97b424 | 2026-01-04T15:53:35.686384Z | false |
scambra/devise_invitable | https://github.com/scambra/devise_invitable/blob/de18ce349314485890754d6c5261ce48ae97b424/test/rails_app/config/environments/production.rb | test/rails_app/config/environments/production.rb | RailsApp::Application.configure do
# Settings specified here will take precedence over those in config/environment.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned o... | ruby | MIT | de18ce349314485890754d6c5261ce48ae97b424 | 2026-01-04T15:53:35.686384Z | false |
scambra/devise_invitable | https://github.com/scambra/devise_invitable/blob/de18ce349314485890754d6c5261ce48ae97b424/lib/devise_invitable.rb | lib/devise_invitable.rb | module DeviseInvitable
autoload :Inviter, 'devise_invitable/inviter'
autoload :Mailer, 'devise_invitable/mailer'
autoload :Mapping, 'devise_invitable/mapping'
autoload :ParameterSanitizer, 'devise_invitable/parameter_sanitizer'
module Controllers
autoload :Registrations, 'devise_invitable/controllers/regi... | ruby | MIT | de18ce349314485890754d6c5261ce48ae97b424 | 2026-01-04T15:53:35.686384Z | false |
scambra/devise_invitable | https://github.com/scambra/devise_invitable/blob/de18ce349314485890754d6c5261ce48ae97b424/lib/generators/mongoid/devise_invitable_generator.rb | lib/generators/mongoid/devise_invitable_generator.rb | require 'generators/devise/orm_helpers'
module Mongoid
module Generators
class DeviseInvitableGenerator < Rails::Generators::NamedBase
end
end
end
| ruby | MIT | de18ce349314485890754d6c5261ce48ae97b424 | 2026-01-04T15:53:35.686384Z | false |
scambra/devise_invitable | https://github.com/scambra/devise_invitable/blob/de18ce349314485890754d6c5261ce48ae97b424/lib/generators/active_record/devise_invitable_generator.rb | lib/generators/active_record/devise_invitable_generator.rb | require 'rails/generators/active_record'
module ActiveRecord
module Generators
class DeviseInvitableGenerator < ActiveRecord::Generators::Base
source_root File.expand_path('../templates', __FILE__)
def copy_devise_migration
migration_template 'migration.rb', "db/migrate/devise_invitable_add_... | ruby | MIT | de18ce349314485890754d6c5261ce48ae97b424 | 2026-01-04T15:53:35.686384Z | false |
scambra/devise_invitable | https://github.com/scambra/devise_invitable/blob/de18ce349314485890754d6c5261ce48ae97b424/lib/generators/active_record/templates/migration.rb | lib/generators/active_record/templates/migration.rb | class DeviseInvitableAddTo<%= table_name.camelize %> < ActiveRecord::Migration<%= migration_version %>
def up
change_table :<%= table_name %> do |t|
t.string :invitation_token
t.datetime :invitation_created_at
t.datetime :invitation_sent_at
t.datetime :invitation_accepted_at
... | ruby | MIT | de18ce349314485890754d6c5261ce48ae97b424 | 2026-01-04T15:53:35.686384Z | false |
scambra/devise_invitable | https://github.com/scambra/devise_invitable/blob/de18ce349314485890754d6c5261ce48ae97b424/lib/generators/devise_invitable/devise_invitable_generator.rb | lib/generators/devise_invitable/devise_invitable_generator.rb | module DeviseInvitable
module Generators
class DeviseInvitableGenerator < Rails::Generators::NamedBase
namespace 'devise_invitable'
desc 'Add :invitable directive in the given model. Also generate migration for ActiveRecord'
def inject_devise_invitable_content
path = File.join('app', '... | ruby | MIT | de18ce349314485890754d6c5261ce48ae97b424 | 2026-01-04T15:53:35.686384Z | false |
scambra/devise_invitable | https://github.com/scambra/devise_invitable/blob/de18ce349314485890754d6c5261ce48ae97b424/lib/generators/devise_invitable/views_generator.rb | lib/generators/devise_invitable/views_generator.rb | require 'generators/devise/views_generator'
module DeviseInvitable
module Generators
class InvitationViewsGenerator < Rails::Generators::Base
include ::Devise::Generators::ViewPathTemplates
def copy_views
view_directory :invitations
end
end
class SimpleFormForGenerator < Invit... | ruby | MIT | de18ce349314485890754d6c5261ce48ae97b424 | 2026-01-04T15:53:35.686384Z | false |
scambra/devise_invitable | https://github.com/scambra/devise_invitable/blob/de18ce349314485890754d6c5261ce48ae97b424/lib/generators/devise_invitable/install_generator.rb | lib/generators/devise_invitable/install_generator.rb | module DeviseInvitable
module Generators
class InstallGenerator < Rails::Generators::Base
source_root File.expand_path('../../templates', __FILE__)
desc 'Add DeviseInvitable config variables to the Devise initializer and copy DeviseInvitable locale files to your application.'
def add_config_opt... | ruby | MIT | de18ce349314485890754d6c5261ce48ae97b424 | 2026-01-04T15:53:35.686384Z | false |
scambra/devise_invitable | https://github.com/scambra/devise_invitable/blob/de18ce349314485890754d6c5261ce48ae97b424/lib/devise_invitable/mailer.rb | lib/devise_invitable/mailer.rb | require 'devise/version'
module DeviseInvitable
module Mailer
# Deliver an invitation email
def invitation_instructions(record, token, opts = {})
@token = token
devise_mail(record, :invitation_instructions, opts)
end
end
end
| ruby | MIT | de18ce349314485890754d6c5261ce48ae97b424 | 2026-01-04T15:53:35.686384Z | false |
scambra/devise_invitable | https://github.com/scambra/devise_invitable/blob/de18ce349314485890754d6c5261ce48ae97b424/lib/devise_invitable/version.rb | lib/devise_invitable/version.rb | module DeviseInvitable
VERSION = '2.0.11'.freeze
end
| ruby | MIT | de18ce349314485890754d6c5261ce48ae97b424 | 2026-01-04T15:53:35.686384Z | false |
scambra/devise_invitable | https://github.com/scambra/devise_invitable/blob/de18ce349314485890754d6c5261ce48ae97b424/lib/devise_invitable/rails.rb | lib/devise_invitable/rails.rb | module DeviseInvitable
class Engine < ::Rails::Engine
ActiveSupport.on_load(:action_controller) do
include DeviseInvitable::Controllers::Helpers
end
# We use to_prepare instead of after_initialize here because Devise is a Rails engine; its
# mailer is reloaded like the rest of the user's app. ... | ruby | MIT | de18ce349314485890754d6c5261ce48ae97b424 | 2026-01-04T15:53:35.686384Z | false |
scambra/devise_invitable | https://github.com/scambra/devise_invitable/blob/de18ce349314485890754d6c5261ce48ae97b424/lib/devise_invitable/inviter.rb | lib/devise_invitable/inviter.rb | module DeviseInvitable
module Inviter
extend ActiveSupport::Concern
included do
extend ClassMethods
attr_writer :invitation_limit unless respond_to? :invitation_limit
end
def invitation_limit
self[:invitation_limit] || self.class.invitation_limit
end
# Return true if this ... | ruby | MIT | de18ce349314485890754d6c5261ce48ae97b424 | 2026-01-04T15:53:35.686384Z | false |
scambra/devise_invitable | https://github.com/scambra/devise_invitable/blob/de18ce349314485890754d6c5261ce48ae97b424/lib/devise_invitable/mapping.rb | lib/devise_invitable/mapping.rb | module DeviseInvitable
module Mapping
private
def default_controllers(options)
unless options[:module]
options[:controllers] ||= {}
options[:controllers][:registrations] ||= 'devise_invitable/registrations'
end
super
end
end
end
| ruby | MIT | de18ce349314485890754d6c5261ce48ae97b424 | 2026-01-04T15:53:35.686384Z | false |
scambra/devise_invitable | https://github.com/scambra/devise_invitable/blob/de18ce349314485890754d6c5261ce48ae97b424/lib/devise_invitable/routes.rb | lib/devise_invitable/routes.rb | module ActionDispatch::Routing
class Mapper
protected
def devise_invitation(mapping, controllers)
resource :invitation, only: [:new, :create, :update],
path: mapping.path_names[:invitation], controller: controllers[:invitations] do
get :edit, path: mapping.path_names[:accept], as: :accep... | ruby | MIT | de18ce349314485890754d6c5261ce48ae97b424 | 2026-01-04T15:53:35.686384Z | false |
scambra/devise_invitable | https://github.com/scambra/devise_invitable/blob/de18ce349314485890754d6c5261ce48ae97b424/lib/devise_invitable/models.rb | lib/devise_invitable/models.rb | require 'active_support/deprecation'
require 'devise_invitable/models/authenticatable'
module Devise
module Models
# Invitable is responsible for sending invitation emails.
# When an invitation is sent to an email address, an account is created for it.
# Invitation email contains a link allowing the user... | ruby | MIT | de18ce349314485890754d6c5261ce48ae97b424 | 2026-01-04T15:53:35.686384Z | false |
scambra/devise_invitable | https://github.com/scambra/devise_invitable/blob/de18ce349314485890754d6c5261ce48ae97b424/lib/devise_invitable/parameter_sanitizer.rb | lib/devise_invitable/parameter_sanitizer.rb | module DeviseInvitable
module ParameterSanitizer
if defined?(Devise::BaseSanitizer)
def invite
permit self.for(:invite)
end
def accept_invitation
permit self.for(:accept_invitation)
end
end
private
if defined?(Devise::BaseSanitizer)
def permit(keys)... | ruby | MIT | de18ce349314485890754d6c5261ce48ae97b424 | 2026-01-04T15:53:35.686384Z | false |
scambra/devise_invitable | https://github.com/scambra/devise_invitable/blob/de18ce349314485890754d6c5261ce48ae97b424/lib/devise_invitable/controllers/helpers.rb | lib/devise_invitable/controllers/helpers.rb | module DeviseInvitable::Controllers::Helpers
extend ActiveSupport::Concern
included do
end
def after_invite_path_for(inviter, invitee = nil)
signed_in_root_path(inviter)
end
def after_accept_path_for(resource)
signed_in_root_path(resource)
end
def invalid_token_path_for(resource_name)
af... | ruby | MIT | de18ce349314485890754d6c5261ce48ae97b424 | 2026-01-04T15:53:35.686384Z | false |
scambra/devise_invitable | https://github.com/scambra/devise_invitable/blob/de18ce349314485890754d6c5261ce48ae97b424/lib/devise_invitable/models/authenticatable.rb | lib/devise_invitable/models/authenticatable.rb | module Devise
module Models
module Authenticatable
list = %i[
invitation_token invitation_created_at invitation_sent_at
invitation_accepted_at invitation_limit invited_by_type
invited_by_id invitations_count
]
if defined?(UNSAFE_ATTRIBUTES_FOR_SERIALIZATION)
... | ruby | MIT | de18ce349314485890754d6c5261ce48ae97b424 | 2026-01-04T15:53:35.686384Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/helpers/comfy/cms_helper.rb | app/helpers/comfy/cms_helper.rb | # frozen_string_literal: true
module Comfy
module CmsHelper
# Raw content of a page fragment. This is how you get content from unrenderable
# tags like {{cms:fragment meta, render: false}}
# Example:
# cms_fragment_content(:left_column, CmsPage.first)
# cms_fragment_content(:left_column) # i... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/helpers/comfy/admin/cms_helper.rb | app/helpers/comfy/admin/cms_helper.rb | # frozen_string_literal: true
module Comfy
module Admin
module CmsHelper
# Wrapper around ComfortableMexicanSofa::FormBuilder
def comfy_form_with(**options, &block)
form_options = options.merge(builder: ComfortableMexicanSofa::FormBuilder)
form_options[:bootstrap] = { layout: :horiz... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/controllers/application_controller.rb | app/controllers/application_controller.rb | # frozen_string_literal: true
class ApplicationController < ActionController::Base
protect_from_forgery
end
| ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/controllers/concerns/comfy/paginate.rb | app/controllers/concerns/comfy/paginate.rb | # frozen_string_literal: true
module Comfy::Paginate
# Wrapper to deal with WillPaginate vs Kaminari nonsense
def comfy_paginate(scope, per_page: 50)
if defined?(WillPaginate)
scope.paginate(page: params[:page], per_page: per_page)
elsif defined?(Kaminari)
scope.page(params[:page]).per(per_pag... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/controllers/concerns/comfy/reorder_action.rb | app/controllers/concerns/comfy/reorder_action.rb | # frozen_string_literal: true
module Comfy::ReorderAction
extend ActiveSupport::Concern
included do
mattr_accessor :reorder_action_resource
end
def reorder
resource_class = self.class.reorder_action_resource
(params.permit(order: [])[:order] || []).each_with_index do |id, index|
resource_c... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/controllers/comfy/admin/base_controller.rb | app/controllers/comfy/admin/base_controller.rb | # frozen_string_literal: true
class Comfy::Admin::BaseController < ComfortableMexicanSofa.config.admin_base_controller.to_s.constantize
include Comfy::Paginate
# Authentication module must have `authenticate` method
include ComfortableMexicanSofa.config.admin_auth.to_s.constantize
# Authorization module mus... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/controllers/comfy/admin/cms/layouts_controller.rb | app/controllers/comfy/admin/cms/layouts_controller.rb | # frozen_string_literal: true
class Comfy::Admin::Cms::LayoutsController < Comfy::Admin::Cms::BaseController
include ::Comfy::ReorderAction
self.reorder_action_resource = ::Comfy::Cms::Layout
before_action :build_layout, only: %i[new create]
before_action :load_layout, only: %i[edit update destroy]
befo... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/controllers/comfy/admin/cms/files_controller.rb | app/controllers/comfy/admin/cms/files_controller.rb | # frozen_string_literal: true
class Comfy::Admin::Cms::FilesController < Comfy::Admin::Cms::BaseController
include ::Comfy::ReorderAction
self.reorder_action_resource = ::Comfy::Cms::File
include ActionView::Helpers::NumberHelper
before_action :build_file, only: %i[new create]
before_action :load_file, ... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/controllers/comfy/admin/cms/translations_controller.rb | app/controllers/comfy/admin/cms/translations_controller.rb | # frozen_string_literal: true
class Comfy::Admin::Cms::TranslationsController < Comfy::Admin::Cms::BaseController
helper_method :translation_select_options
before_action :load_page
before_action :build_translation, only: %i[new create]
before_action :load_translation, only: %i[edit update destroy]
bef... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/controllers/comfy/admin/cms/categories_controller.rb | app/controllers/comfy/admin/cms/categories_controller.rb | # frozen_string_literal: true
class Comfy::Admin::Cms::CategoriesController < Comfy::Admin::Cms::BaseController
before_action :load_category, only: %i[edit update destroy]
before_action :authorize
def edit
render
end
def create
@category = @site.categories.create!(category_params)
rescue ActiveR... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/controllers/comfy/admin/cms/sites_controller.rb | app/controllers/comfy/admin/cms/sites_controller.rb | # frozen_string_literal: true
class Comfy::Admin::Cms::SitesController < Comfy::Admin::Cms::BaseController
skip_before_action :load_admin_site,
:load_seeds
before_action :build_site, only: %i[new create]
before_action :load_site, only: %i[edit update destroy]
before_action :authoriz... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/controllers/comfy/admin/cms/snippets_controller.rb | app/controllers/comfy/admin/cms/snippets_controller.rb | # frozen_string_literal: true
class Comfy::Admin::Cms::SnippetsController < Comfy::Admin::Cms::BaseController
include ::Comfy::ReorderAction
self.reorder_action_resource = ::Comfy::Cms::Snippet
before_action :build_snippet, only: %i[new create]
before_action :load_snippet, only: %i[edit update destroy]
be... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/controllers/comfy/admin/cms/base_controller.rb | app/controllers/comfy/admin/cms/base_controller.rb | # frozen_string_literal: true
class Comfy::Admin::Cms::BaseController < Comfy::Admin::BaseController
before_action :load_admin_site,
:set_locale,
:load_seeds,
except: :jump
layout :infer_layout
if ComfortableMexicanSofa.config.admin_cache_sweeper.present?
ca... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/controllers/comfy/admin/cms/pages_controller.rb | app/controllers/comfy/admin/cms/pages_controller.rb | # frozen_string_literal: true
class Comfy::Admin::Cms::PagesController < Comfy::Admin::Cms::BaseController
include ::Comfy::ReorderAction
self.reorder_action_resource = ::Comfy::Cms::Page
before_action :check_for_layouts, only: %i[new edit]
before_action :build_page, only: %i[new create]
before_acti... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/controllers/comfy/admin/cms/revisions/layout_controller.rb | app/controllers/comfy/admin/cms/revisions/layout_controller.rb | # frozen_string_literal: true
class Comfy::Admin::Cms::Revisions::LayoutController < Comfy::Admin::Cms::Revisions::BaseController
private
def load_record
@record = @site.layouts.find(params[:layout_id])
rescue ActiveRecord::RecordNotFound
flash[:danger] = I18n.t("comfy.admin.cms.revisions.record_not_foun... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/controllers/comfy/admin/cms/revisions/page_controller.rb | app/controllers/comfy/admin/cms/revisions/page_controller.rb | # frozen_string_literal: true
class Comfy::Admin::Cms::Revisions::PageController < Comfy::Admin::Cms::Revisions::BaseController
def show
@current_content = @record.fragments.each_with_object({}) do |b, c|
c[b.identifier] = b.content
end
@versioned_content = @record.fragments.each_with_object({}) d... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/controllers/comfy/admin/cms/revisions/base_controller.rb | app/controllers/comfy/admin/cms/revisions/base_controller.rb | # frozen_string_literal: true
class Comfy::Admin::Cms::Revisions::BaseController < Comfy::Admin::Cms::BaseController
helper_method :record_path
before_action :load_record
before_action :load_revision, except: :index
before_action :authorize
def index
revision = @record.revisions.order(created_at: :des... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/controllers/comfy/admin/cms/revisions/snippet_controller.rb | app/controllers/comfy/admin/cms/revisions/snippet_controller.rb | # frozen_string_literal: true
class Comfy::Admin::Cms::Revisions::SnippetController < Comfy::Admin::Cms::Revisions::BaseController
private
def load_record
@record = @site.snippets.find(params[:snippet_id])
rescue ActiveRecord::RecordNotFound
flash[:danger] = I18n.t("comfy.admin.cms.revisions.record_not_f... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/controllers/comfy/admin/cms/revisions/translation_controller.rb | app/controllers/comfy/admin/cms/revisions/translation_controller.rb | # frozen_string_literal: true
class Comfy::Admin::Cms::Revisions::TranslationController < Comfy::Admin::Cms::Revisions::BaseController
def show
@current_content = @record.fragments.each_with_object({}) do |b, c|
c[b.identifier] = b.content
end
@versioned_content = @record.fragments.each_with_objec... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/controllers/comfy/cms/content_controller.rb | app/controllers/comfy/cms/content_controller.rb | # frozen_string_literal: true
class Comfy::Cms::ContentController < Comfy::Cms::BaseController
# Authentication module must have `authenticate` method
include ComfortableMexicanSofa.config.public_auth.to_s.constantize
# Authorization module must have `authorize` method
include ComfortableMexicanSofa.config.p... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/controllers/comfy/cms/base_controller.rb | app/controllers/comfy/cms/base_controller.rb | # frozen_string_literal: true
class Comfy::Cms::BaseController < ComfortableMexicanSofa.config.public_base_controller.to_s.constantize
before_action :load_cms_site
helper Comfy::CmsHelper
protected
def load_cms_site
@cms_site ||=
if params[:site_id]
::Comfy::Cms::Site.find_by_id(params[:sit... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/controllers/comfy/cms/assets_controller.rb | app/controllers/comfy/cms/assets_controller.rb | # frozen_string_literal: true
class Comfy::Cms::AssetsController < Comfy::Cms::BaseController
skip_before_action :verify_authenticity_token, raise: false
before_action :load_cms_layout,
:use_null_session
after_action :set_cache_control_header
def render_css
render body: @cms_layout.css,... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/models/concerns/comfy/cms/with_fragments.rb | app/models/concerns/comfy/cms/with_fragments.rb | # frozen_string_literal: true
module Comfy::Cms::WithFragments
extend ActiveSupport::Concern
included do
attr_accessor :fragments_attributes_changed
belongs_to :layout,
class_name: "Comfy::Cms::Layout"
has_many :fragments,
class_name: "Comfy::Cms::Fragment",
as: :record,
... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/models/concerns/comfy/cms/with_categories.rb | app/models/concerns/comfy/cms/with_categories.rb | # frozen_string_literal: true
module Comfy::Cms::WithCategories
extend ActiveSupport::Concern
included do
has_many :categorizations,
as: :categorized,
class_name: "Comfy::Cms::Categorization",
dependent: :destroy
has_many :categories,
through: :categorizations,
c... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/models/comfy/cms/snippet.rb | app/models/comfy/cms/snippet.rb | # frozen_string_literal: true
class Comfy::Cms::Snippet < ActiveRecord::Base
self.table_name = "comfy_cms_snippets"
include Comfy::Cms::WithCategories
cms_has_revisions_for :content
# -- Relationships -----------------------------------------------------------
belongs_to :site
# -- Callbacks ---------... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/models/comfy/cms/revision.rb | app/models/comfy/cms/revision.rb | # frozen_string_literal: true
class Comfy::Cms::Revision < ActiveRecord::Base
self.table_name = "comfy_cms_revisions"
serialize :data
# -- Relationships --------------------------------------------------------
belongs_to :record, polymorphic: true
end
| ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/models/comfy/cms/translation.rb | app/models/comfy/cms/translation.rb | # frozen_string_literal: true
class Comfy::Cms::Translation < ActiveRecord::Base
self.table_name = "comfy_cms_translations"
include Comfy::Cms::WithFragments
cms_has_revisions_for :fragments_attributes
delegate :site, to: :page
# -- Relationships ---------------------------------------------------------... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/models/comfy/cms/page.rb | app/models/comfy/cms/page.rb | # frozen_string_literal: true
class Comfy::Cms::Page < ActiveRecord::Base
self.table_name = "comfy_cms_pages"
include Comfy::Cms::WithFragments
include Comfy::Cms::WithCategories
cms_acts_as_tree counter_cache: :children_count, order: :position
cms_has_revisions_for :fragments_attributes
attr_accessor ... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/models/comfy/cms/fragment.rb | app/models/comfy/cms/fragment.rb | # frozen_string_literal: true
class Comfy::Cms::Fragment < ActiveRecord::Base
self.table_name = "comfy_cms_fragments"
has_many_attached :attachments
serialize :content
attr_reader :files
# -- Callbacks ---------------------------------------------------------------
# active_storage attachment behavior... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/models/comfy/cms/file.rb | app/models/comfy/cms/file.rb | # frozen_string_literal: true
class Comfy::Cms::File < ActiveRecord::Base
self.table_name = "comfy_cms_files"
include Comfy::Cms::WithCategories
VARIANT_SIZE = {
redactor: { resize: "100x75^", gravity: "center", crop: "100x75+0+0" },
thumb: { resize: "200x150^", gravity: "center", crop: "200x150... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/models/comfy/cms/category.rb | app/models/comfy/cms/category.rb | # frozen_string_literal: true
class Comfy::Cms::Category < ActiveRecord::Base
self.table_name = "comfy_cms_categories"
# -- Relationships --------------------------------------------------------
belongs_to :site
has_many :categorizations,
dependent: :destroy
# -- Validations --------------------------... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/models/comfy/cms/categorization.rb | app/models/comfy/cms/categorization.rb | # frozen_string_literal: true
class Comfy::Cms::Categorization < ActiveRecord::Base
self.table_name = "comfy_cms_categorizations"
# -- Relationships -----------------------------------------------------------
belongs_to :category
belongs_to :categorized,
polymorphic: true
# -- Validations ------------... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/models/comfy/cms/layout.rb | app/models/comfy/cms/layout.rb | # frozen_string_literal: true
class Comfy::Cms::Layout < ActiveRecord::Base
self.table_name = "comfy_cms_layouts"
cms_acts_as_tree
cms_has_revisions_for :content, :css, :js
# -- Relationships --------------------------------------------------------
belongs_to :site
has_many :pages, dependent: :nullify
... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/app/models/comfy/cms/site.rb | app/models/comfy/cms/site.rb | # frozen_string_literal: true
class Comfy::Cms::Site < ActiveRecord::Base
self.table_name = "comfy_cms_sites"
# -- Relationships -----------------------------------------------------------
with_options dependent: :destroy do |site|
site.has_many :layouts
site.has_many :pages
site.has_many :snippets... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/db/migrate/01_create_cms.rb | db/migrate/01_create_cms.rb | class CreateCms < ActiveRecord::Migration[5.2]
LIMIT = 16777215
def change
# -- Sites -----------------------------------------------------------------
create_table :comfy_cms_sites, force: true do |t|
t.string :label, null: false
t.string :identifier, null: false
t.string :hos... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/db/migrate/00_create_active_storage_tables.active_storage.rb | db/migrate/00_create_active_storage_tables.active_storage.rb | # This migration comes from active_storage (originally 20170806125915)
class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
def change
create_table :active_storage_blobs do |t|
t.string :key, null: false
t.string :filename, null: false
t.string :content_type
t.text... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/test_helper.rb | test/test_helper.rb | # frozen_string_literal: true
ENV["RAILS_ENV"] = "test"
# In CI envoronment I don't want to send coverage report for system tests that
# obviously don't cover everything 100%
unless ENV["SKIP_COV"]
require "simplecov"
require "coveralls"
SimpleCov.formatter = Coveralls::SimpleCov::Formatter
SimpleCov.start do... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/tasks/cms_seeds_test.rb | test/tasks/cms_seeds_test.rb | # frozen_string_literal: true
require_relative "../test_helper"
require "rake"
class CmsSeedsTaskTest < ActiveSupport::TestCase
setup do
@rake = Rake::Application.new
Rake.application = @rake
# We force rake file reload by passing empty array as the last parameter
Rake.application.rake_require("tas... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/system/layouts_frontend_test.rb | test/system/layouts_frontend_test.rb | # frozen_string_literal: true
require_relative "../test_helper"
class LayoutsFrontendTest < ApplicationSystemTestCase
setup do
@site = comfy_cms_sites(:default)
end
def test_new_identifier
visit_p new_comfy_admin_cms_site_layout_path(@site)
fill_in "Layout Name", with: "Test Layout"
assert_equ... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/system/files_frontend_test.rb | test/system/files_frontend_test.rb | # frozen_string_literal: true
require_relative "../test_helper"
class FilesFrontendTest < ApplicationSystemTestCase
setup do
@site = comfy_cms_sites(:default)
@layout = comfy_cms_layouts(:default)
@page = comfy_cms_pages(:default)
end
def test_site_file_drag_and_drop
skip
# Dragg... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/system/pages_frontend_test.rb | test/system/pages_frontend_test.rb | # frozen_string_literal: true
require_relative "../test_helper"
class PagesFrontendTest < ApplicationSystemTestCase
setup do
@site = comfy_cms_sites(:default)
end
def test_new_identifier
visit_p new_comfy_admin_cms_site_page_path(@site)
fill_in "Label", with: "Test Page"
assert_equal "test-pag... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/system/categories_frontend_test.rb | test/system/categories_frontend_test.rb | # frozen_string_literal: true
require_relative "../test_helper"
class CategoriesFrontendTest < ApplicationSystemTestCase
setup do
@site = comfy_cms_sites(:default)
end
def test_category_management
visit_p comfy_admin_cms_site_snippets_path(@site)
find("button.toggle-cat-edit").click
selector ... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/system/snippets_frontend_test.rb | test/system/snippets_frontend_test.rb | # frozen_string_literal: true
require_relative "../test_helper"
class SnippetsFrontendTest < ApplicationSystemTestCase
setup do
@site = comfy_cms_sites(:default)
end
def test_new_identifier
visit_p new_comfy_admin_cms_site_snippet_path(@site)
fill_in "Label", with: "Test Snippet"
assert_equal ... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/system/sites_frontend_test.rb | test/system/sites_frontend_test.rb | # frozen_string_literal: true
require_relative "../test_helper"
class SitesFrontendTest < ApplicationSystemTestCase
def test_new_identifier
visit_p new_comfy_admin_cms_site_path
fill_in "Label", with: "Test Site"
assert_equal "test-site", find_field("Identifier").value
end
end
| ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/integration/sites_test.rb | test/integration/sites_test.rb | # frozen_string_literal: true
require_relative "../test_helper"
class SitesIntegrationTest < ActionDispatch::IntegrationTest
def test_get_admin_with_single_site
r :get, comfy_admin_cms_path
assert assigns(:site)
assert_equal comfy_cms_sites(:default), assigns(:site)
assert_response :redirect
as... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/integration/render_cms_test.rb | test/integration/render_cms_test.rb | # frozen_string_literal: true
require_relative "../test_helper"
class RenderCmsIntergrationTest < ActionDispatch::IntegrationTest
def setup
super
Rails.application.routes.draw do
get "/render-basic" => "render_test#render_basic"
get "/render-page" => "render_test#render_pag... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/integration/routing_test.rb | test/integration/routing_test.rb | # frozen_string_literal: true
require_relative "../test_helper"
class RoutingIntergrationTest < ActionDispatch::IntegrationTest
def teardown
Rails.application.reload_routes!
end
def test_cms_public_prefix
assert_nil ComfortableMexicanSofa.config.public_cms_path
Rails.application.routes.draw do
... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/integration/view_hooks_test.rb | test/integration/view_hooks_test.rb | # frozen_string_literal: true
require_relative "../test_helper"
class ViewHooksIntegrationTest < ActionDispatch::IntegrationTest
def teardown
ComfortableMexicanSofa::ViewHooks.remove(:navigation)
end
def test_hooks_rendering
Comfy::Admin::Cms::SitesController.append_view_path(File.expand_path("../fixt... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/integration/seeds_test.rb | test/integration/seeds_test.rb | # frozen_string_literal: true
require_relative "../test_helper"
class SeedsIntergrationTest < ActionDispatch::IntegrationTest
setup do
@site = comfy_cms_sites(:default)
@site.update_columns(identifier: "sample-site")
end
def test_seeds_disabled
assert_no_difference ["Comfy::Cms::Layout.count", "Co... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/integration/i18n_test.rb | test/integration/i18n_test.rb | # frozen_string_literal: true
require_relative "../test_helper"
class I18nIntegrationTest < ActionDispatch::IntegrationTest
def collect_combined_keys(hash, ns = nil)
hash.collect do |k, v|
keys = []
keys << collect_combined_keys(v, "#{ns}.#{k}") if v.is_a?(Hash)
keys << "#{ns}.#{k}"
end.f... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/integration/access_control_test.rb | test/integration/access_control_test.rb | # frozen_string_literal: true
require_relative "../test_helper"
class AccessControlTest < ActionDispatch::IntegrationTest
module TestAuthentication
module Authenticate
def authenticate
render plain: "Test Login Denied", status: :unauthorized
end
end
# faking ComfortableMexicanSo... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/integration/meta_variables_test.rb | test/integration/meta_variables_test.rb | # frozen_string_literal: true
require_relative "../test_helper"
class MetaVariablesIntegrationTest < ActionDispatch::IntegrationTest
def test_redactor_js_variables
site = comfy_cms_sites(:default)
r :get, comfy_admin_cms_site_pages_path(site)
assert_response :success
assert_select "meta[name='cms-... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/helpers/cms_helper_test.rb | test/helpers/cms_helper_test.rb | # frozen_string_literal: true
require_relative "../test_helper"
class CmsHelperTest < ActionView::TestCase
include Comfy::CmsHelper
module TestViewHelpers
def hello
"hello"
end
end
ActionView::Base.send :include, TestViewHelpers
setup do
# we're simulating instance variables that are ... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/helpers/admin_cms_helper_test.rb | test/helpers/admin_cms_helper_test.rb | # frozen_string_literal: true
require_relative "../test_helper"
class AdminCmsHelpersTest < ActionView::TestCase
include Comfy::Admin::CmsHelper
include ComfyBootstrapForm::ViewHelper
setup do
@file = comfy_cms_files(:default)
end
def test_comfy_form_with
actual = comfy_form_with(url: "/test") do... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/fixtures/generators/scaffold/routes.rb | test/fixtures/generators/scaffold/routes.rb | Test::Application.routes.draw do
namespace :admin do
resources :foos
end
end
| ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/fixtures/generators/scaffold/controller.rb | test/fixtures/generators/scaffold/controller.rb | class Admin::FoosController < Comfy::Admin::BaseController
before_action :build_foo, only: [:new, :create]
before_action :load_foo, only: [:show, :edit, :update, :destroy]
def index
@foos = Foo.page(params[:page])
end
def show
render
end
def new
render
end
def edit
render
end... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/fixtures/generators/scaffold/migration.rb | test/fixtures/generators/scaffold/migration.rb | class CreateFoos < ActiveRecord::Migration[5.2]
def change
create_table :foos do |t|
t.string :bar
t.timestamps
end
end
end
| ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/fixtures/generators/scaffold/model.rb | test/fixtures/generators/scaffold/model.rb | class Foo < ActiveRecord::Base
# -- Relationships -----------------------------------------------------------
# -- Callbacks ---------------------------------------------------------------
# -- Validations -------------------------------------------------------------
# -- Scopes -------------------------... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/fixtures/generators/scaffold/tests/controller.rb | test/fixtures/generators/scaffold/tests/controller.rb | require_relative '../../test_helper'
class Admin::FoosControllerTest < ActionDispatch::IntegrationTest
setup do
@foo = foos(:default)
end
# Vanilla CMS has BasicAuth, so we need to send that with each request.
# Change this to fit your app's authentication strategy.
# Move this to test_helper.rb
def ... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/fixtures/generators/scaffold/tests/model.rb | test/fixtures/generators/scaffold/tests/model.rb | require_relative '../test_helper'
class FooTest < ActiveSupport::TestCase
def test_fixtures_validity
Foo.all.each do |foo|
assert foo.valid?, foo.errors.inspect
end
end
def test_validation
foo = Foo.new
assert foo.invalid?
assert_equal [:bar], foo.errors.keys
end
def test_creatio... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/fixtures/generators/cms/application.rb | test/fixtures/generators/cms/application.rb | module TestApp
class Application < Rails::Application
# Ensuring that ActiveStorage routes are loaded before Comfy's globbing
# route. Without this file serving routes are inaccessible.
config.railties_order = [ActiveStorage::Engine, :main_app, :all]
end
end
| ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/fixtures/generators/cms/routes.rb | test/fixtures/generators/cms/routes.rb | Test::Application.routes.draw do
comfy_route :cms_admin, path: "/admin"
# Ensure that this route is defined last
comfy_route :cms, path: "/"
end
| ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/controllers/comfy/admin/cms/sites_controller_test.rb | test/controllers/comfy/admin/cms/sites_controller_test.rb | # frozen_string_literal: true
require_relative "../../../../test_helper"
class Comfy::Admin::Cms::SitesControllerTest < ActionDispatch::IntegrationTest
def test_get_index
Comfy::Cms::Site.create!(hostname: "other.test")
r :get, comfy_admin_cms_sites_path
assert_response :success
assert assigns(:si... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/controllers/comfy/admin/cms/base_controller_test.rb | test/controllers/comfy/admin/cms/base_controller_test.rb | # frozen_string_literal: true
require_relative "../../../../test_helper"
class Comfy::Admin::Cms::BaseControllerTest < ActionDispatch::IntegrationTest
def test_get_jump
r :get, comfy_admin_cms_path
assert_response :redirect
assert_redirected_to comfy_admin_cms_site_pages_path(comfy_cms_sites(:default))... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/controllers/comfy/admin/cms/translations_controller_test.rb | test/controllers/comfy/admin/cms/translations_controller_test.rb | # frozen_string_literal: true
require_relative "../../../../test_helper"
class Comfy::Admin::Cms::TranslationsControllerTest < ActionDispatch::IntegrationTest
setup do
@site = comfy_cms_sites(:default)
@layout = comfy_cms_layouts(:default)
@page = comfy_cms_pages(:default)
@tr... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/controllers/comfy/admin/cms/categories_controller_test.rb | test/controllers/comfy/admin/cms/categories_controller_test.rb | # frozen_string_literal: true
require_relative "../../../../test_helper"
class Comfy::Admin::Cms::CategoriesControllerTest < ActionDispatch::IntegrationTest
def setup
@site = comfy_cms_sites(:default)
end
def test_get_edit
r :get, edit_comfy_admin_cms_site_category_path(site_id: @site, id: comfy_cms_c... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/controllers/comfy/admin/cms/files_controller_test.rb | test/controllers/comfy/admin/cms/files_controller_test.rb | # frozen_string_literal: true
require_relative "../../../../test_helper"
class Comfy::Admin::Cms::FilesControllerTest < ActionDispatch::IntegrationTest
def setup
@site = comfy_cms_sites(:default)
@file = comfy_cms_files(:default)
end
def test_get_index
@site.files.create!(
label: "other",
... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/controllers/comfy/admin/cms/snippets_controller_test.rb | test/controllers/comfy/admin/cms/snippets_controller_test.rb | # frozen_string_literal: true
require_relative "../../../../test_helper"
class Comfy::Admin::Cms::SnippetsControllerTest < ActionDispatch::IntegrationTest
setup do
@site = comfy_cms_sites(:default)
@snippet = comfy_cms_snippets(:default)
end
def test_get_index
@site.snippets.create!(identifie... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/controllers/comfy/admin/cms/pages_controller_test.rb | test/controllers/comfy/admin/cms/pages_controller_test.rb | # frozen_string_literal: true
require_relative "../../../../test_helper"
class Comfy::Admin::Cms::PagesControllerTest < ActionDispatch::IntegrationTest
def setup
@site = comfy_cms_sites(:default)
@layout = comfy_cms_layouts(:default)
@page = comfy_cms_pages(:default)
end
def test_get_index
... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/controllers/comfy/admin/cms/layouts_controller_test.rb | test/controllers/comfy/admin/cms/layouts_controller_test.rb | # frozen_string_literal: true
require_relative "../../../../test_helper"
class Comfy::Admin::Cms::LayoutsControllerTest < ActionDispatch::IntegrationTest
setup do
@site = comfy_cms_sites(:default)
end
def test_get_index
@site.layouts.create!(identifier: "other")
r :get, comfy_admin_cms_site_layou... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/controllers/comfy/admin/cms/revisions/layout_controller_test.rb | test/controllers/comfy/admin/cms/revisions/layout_controller_test.rb | # frozen_string_literal: true
require_relative "../../../../../test_helper"
class Comfy::Admin::Cms::Revisions::LayoutControllerTest < ActionDispatch::IntegrationTest
setup do
@site = comfy_cms_sites(:default)
@layout = comfy_cms_layouts(:default)
@revision = comfy_cms_revisions(:layout)
end
... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/controllers/comfy/admin/cms/revisions/snippet_controller_test.rb | test/controllers/comfy/admin/cms/revisions/snippet_controller_test.rb | # frozen_string_literal: true
require_relative "../../../../../test_helper"
class Comfy::Admin::Cms::Revisions::SnippetControllerTest < ActionDispatch::IntegrationTest
setup do
@site = comfy_cms_sites(:default)
@snippet = comfy_cms_snippets(:default)
@revision = comfy_cms_revisions(:snippet)
end... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
comfy/comfortable-mexican-sofa | https://github.com/comfy/comfortable-mexican-sofa/blob/8f7e425a06aca9cfa8e21de6b7a10669c8495fc3/test/controllers/comfy/admin/cms/revisions/translation_controller_test.rb | test/controllers/comfy/admin/cms/revisions/translation_controller_test.rb | # frozen_string_literal: true
require_relative "../../../../../test_helper"
class Comfy::Admin::Cms::Revisions::TranslationControllerTest < ActionDispatch::IntegrationTest
setup do
@site = comfy_cms_sites(:default)
@page = comfy_cms_pages(:default)
@translation = comfy_cms_translations... | ruby | MIT | 8f7e425a06aca9cfa8e21de6b7a10669c8495fc3 | 2026-01-04T15:53:10.116705Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.