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
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/resource/model.rb
lib/active_admin/resource/model.rb
# frozen_string_literal: true module ActiveAdmin class Model def initialize(resource, record) @record = record if resource @record.extend(resource.resource_name_extension) end end def to_model @record end end end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/resource/naming.rb
lib/active_admin/resource/naming.rb
# frozen_string_literal: true module ActiveAdmin class Resource module Naming def resource_name @resource_name ||= begin as = @options[:as].gsub(/\s/, "") if @options[:as] if as || !resource_class.respond_to?(:model_name) Name.new resource_class, as else ...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/resource/ordering.rb
lib/active_admin/resource/ordering.rb
# frozen_string_literal: true module ActiveAdmin class Resource module Ordering def ordering @ordering ||= {}.with_indifferent_access end end end end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/helpers/optional_display.rb
lib/active_admin/helpers/optional_display.rb
# frozen_string_literal: true module ActiveAdmin # Shareable module to give a #display_on?(action) method # which returns true or false depending on an options hash. # # The options hash accepts: # # only: :index # only: [:index, :show] # except: :index # except: [:index, :show] # # call #normali...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/helpers/scope_chain.rb
lib/active_admin/helpers/scope_chain.rb
# frozen_string_literal: true module ActiveAdmin module ScopeChain private # Scope an ActiveRecord::Relation chain # # Example: # scope_chain(Scope.new(:published), Article) # # => Article.published # # @param scope The <ActiveAdmin::Scope> we want to scope on # @param chain Th...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/helpers/routes/url_helpers.rb
lib/active_admin/helpers/routes/url_helpers.rb
# frozen_string_literal: true module ActiveAdmin module Helpers module Routes module UrlHelpers include Rails.application.routes.url_helpers end extend UrlHelpers def self.default_url_options Rails.application.routes.default_url_options || {} end end end end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/view_helpers/method_or_proc_helper.rb
lib/active_admin/view_helpers/method_or_proc_helper.rb
# frozen_string_literal: true # Utility methods for internal use. # @private module MethodOrProcHelper extend self # This method will either call the symbol on self or instance_exec the Proc # within self. Any args will be passed along to the method dispatch. # # Calling with a Symbol: # # call_metho...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/views/index_as_table.rb
lib/active_admin/views/index_as_table.rb
# frozen_string_literal: true module ActiveAdmin module Views # # Index as a Table # # By default, the index page is a table with each of the models content columns and links to # show, edit and delete the object. There are many ways to customize what gets # displayed. # # ## Defining Col...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/views/components/panel.rb
lib/active_admin/views/components/panel.rb
# frozen_string_literal: true module ActiveAdmin module Views class Panel < ActiveAdmin::Component builder_method :panel def build(title, attributes = {}) super(attributes) add_class "panel" @title = h3(title.to_s, class: "panel-title") @contents = div(class: "panel-b...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/views/components/attributes_table.rb
lib/active_admin/views/components/attributes_table.rb
# frozen_string_literal: true module ActiveAdmin module Views class AttributesTable < ActiveAdmin::Component builder_method :attributes_table_for def build(obj, *attrs) @collection = Array.wrap(obj) @resource_class = @collection.first.class options = {} options[:for] ...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/views/components/table_for.rb
lib/active_admin/views/components/table_for.rb
# frozen_string_literal: true module ActiveAdmin module Views class TableFor < Arbre::HTML::Table builder_method :table_for def tag_name "table" end def build(obj, *attrs) options = attrs.extract_options! @sortable = options.delete(:sortable) @collection =...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/views/components/status_tag.rb
lib/active_admin/views/components/status_tag.rb
# frozen_string_literal: true module ActiveAdmin module Views # Build a StatusTag class StatusTag < ActiveAdmin::Component builder_method :status_tag def tag_name "span" end # @overload status_tag(status, options = {}) # @param [String] status the status to display. ...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/views/components/scopes.rb
lib/active_admin/views/components/scopes.rb
# frozen_string_literal: true require_relative "../../async_count" require_relative "../../view_helpers/method_or_proc_helper" module ActiveAdmin module Views # Renders a collection of ActiveAdmin::Scope objects as a # simple list with a separator class Scopes < ActiveAdmin::Component include Activ...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/views/components/index_list.rb
lib/active_admin/views/components/index_list.rb
# frozen_string_literal: true module ActiveAdmin module Views # Renders a collection of index views available to the resource # as a list with a separator class IndexList < ActiveAdmin::Component def tag_name "div" end # Builds the links for presenting different index views to t...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/views/components/paginated_collection.rb
lib/active_admin/views/components/paginated_collection.rb
# frozen_string_literal: true module ActiveAdmin module Views # Wraps the content with pagination and available formats. # # *Example:* # # paginated_collection collection, entry_name: "Post" do # div do # h2 "Inside the # end # end # # This will create a ...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/views/components/active_admin_form.rb
lib/active_admin/views/components/active_admin_form.rb
# frozen_string_literal: true module ActiveAdmin module Views class FormtasticProxy < ::Arbre::Rails::Forms::FormBuilderProxy def split_string_on(string, match) return "" unless string && match part_1 = string.split(Regexp.new("#{match}\\z")).first [part_1, match] end de...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/orm/active_record.rb
lib/active_admin/orm/active_record.rb
# frozen_string_literal: true # ActiveRecord-specific plugins should be required here ActiveAdmin::DatabaseHitDuringLoad.database_error_classes << ActiveRecord::StatementInvalid require_relative "active_record/comments"
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/orm/active_record/comments.rb
lib/active_admin/orm/active_record/comments.rb
# frozen_string_literal: true require_relative "comments/views" require_relative "comments/namespace_helper" require_relative "comments/resource_helper" # Add the comments configuration ActiveAdmin::Application.inheritable_setting :comments, true ActiveAdmin::Application.inheritable_setting :comments_registration_name...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/orm/active_record/comments/views.rb
lib/active_admin/orm/active_record/comments/views.rb
# frozen_string_literal: true require_relative "../../../views" require_relative "views/active_admin_comments"
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/orm/active_record/comments/comment.rb
lib/active_admin/orm/active_record/comments/comment.rb
# frozen_string_literal: true module ActiveAdmin class Comment < ActiveRecord::Base self.table_name = "#{table_name_prefix}active_admin_comments#{table_name_suffix}" belongs_to :resource, polymorphic: true, optional: true belongs_to :author, polymorphic: true validates_presence_of :body, :namespace...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/orm/active_record/comments/resource_helper.rb
lib/active_admin/orm/active_record/comments/resource_helper.rb
# frozen_string_literal: true module ActiveAdmin module Comments module ResourceHelper extend ActiveSupport::Concern included do attr_accessor :comments end def comments? (namespace.comments? && comments != false) || comments == true end end end end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/orm/active_record/comments/namespace_helper.rb
lib/active_admin/orm/active_record/comments/namespace_helper.rb
# frozen_string_literal: true module ActiveAdmin module Comments module NamespaceHelper # Returns true if the namespace allows comments def comments? comments == true end end end end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/orm/active_record/comments/views/active_admin_comments.rb
lib/active_admin/orm/active_record/comments/views/active_admin_comments.rb
# frozen_string_literal: true require_relative "../../../../views" module ActiveAdmin module Comments module Views class Comments < Arbre::Element builder_method :active_admin_comments_for def build(resource) if authorized?(ActiveAdmin::Auth::READ, ActiveAdmin::Comment) ...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/filters/forms.rb
lib/active_admin/filters/forms.rb
# frozen_string_literal: true module ActiveAdmin module Filters # This form builder defines methods to build filter forms such # as the one found in the sidebar of the index page of a standard resource. class FormBuilder < ::ActiveAdmin::FormBuilder include ::ActiveAdmin::Filters::FormtasticAddons ...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/filters/dsl.rb
lib/active_admin/filters/dsl.rb
# frozen_string_literal: true module ActiveAdmin module Filters module DSL # For docs, please see ActiveAdmin::Filters::ResourceExtension#add_filter def filter(attribute, options = {}) config.add_filter(attribute, options) end # For docs, please see ActiveAdmin::Filters::Resource...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/filters/formtastic_addons.rb
lib/active_admin/filters/formtastic_addons.rb
# frozen_string_literal: true module ActiveAdmin module Filters module FormtasticAddons # # The below are Formtastic method overrides that jump inside of the Ransack # search object to get at the object being searched upon. # def humanized_method_name if klass.respond_to?(:...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/filters/active.rb
lib/active_admin/filters/active.rb
# frozen_string_literal: true require_relative "active_filter" module ActiveAdmin module Filters class Active attr_reader :filters, :resource, :scopes # Instantiate a `Active` object containing collection of current active filters # @param resource [ActiveAdmin::Resource] current resource ...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/filters/active_filter.rb
lib/active_admin/filters/active_filter.rb
# frozen_string_literal: true module ActiveAdmin module Filters class ActiveFilter attr_reader :resource, :condition, :related_class # Instantiate a `ActiveFilter` # # @param resource [ActiveAdmin::Resource] current resource # @param condition [Ransack::Nodes::Condition] applied ra...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/filters/resource_extension.rb
lib/active_admin/filters/resource_extension.rb
# frozen_string_literal: true require_relative "active" module ActiveAdmin module Filters class Disabled < RuntimeError def initialize(action) super "Cannot #{action} a filter when filters are disabled. Enable filters with 'config.filters = true'" end end module ResourceExtension ...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/localizers/resource_localizer.rb
lib/active_admin/localizers/resource_localizer.rb
# frozen_string_literal: true module ActiveAdmin module Localizers class ResourceLocalizer class << self def from_resource(resource_config) new(resource_config.resource_name.i18n_key, resource_config.resource_label) end def translate(key, options) new(options.del...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/inputs/filters/check_boxes_input.rb
lib/active_admin/inputs/filters/check_boxes_input.rb
# frozen_string_literal: true module ActiveAdmin module Inputs module Filters class CheckBoxesInput < ::Formtastic::Inputs::CheckBoxesInput include Base def input_name "#{object_name}[#{searchable_method_name}_in][]" end def selected_values @object.publi...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/inputs/filters/string_input.rb
lib/active_admin/inputs/filters/string_input.rb
# frozen_string_literal: true module ActiveAdmin module Inputs module Filters class StringInput < ::Formtastic::Inputs::StringInput include Base include Base::SearchMethodSelect filter :cont, :eq, :start, :end # If the filter method includes a search condition, build a norm...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/inputs/filters/base.rb
lib/active_admin/inputs/filters/base.rb
# frozen_string_literal: true module ActiveAdmin module Inputs module Filters module Base include ::Formtastic::Inputs::Base include ::ActiveAdmin::Filters::FormtasticAddons extend ::ActiveSupport::Autoload autoload :SearchMethodSelect def input_wrapping(&block) ...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/inputs/filters/numeric_input.rb
lib/active_admin/inputs/filters/numeric_input.rb
# frozen_string_literal: true module ActiveAdmin module Inputs module Filters class NumericInput < ::Formtastic::Inputs::NumberInput include Base include Base::SearchMethodSelect filter :eq, :gt, :lt end end end end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/inputs/filters/date_range_input.rb
lib/active_admin/inputs/filters/date_range_input.rb
# frozen_string_literal: true module ActiveAdmin module Inputs module Filters class DateRangeInput < ::Formtastic::Inputs::StringInput include Base def to_html input_wrapping do [ label_html, '<div class="filters-form-input-group">', builder...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/inputs/filters/boolean_input.rb
lib/active_admin/inputs/filters/boolean_input.rb
# frozen_string_literal: true module ActiveAdmin module Inputs module Filters class BooleanInput < ::Formtastic::Inputs::SelectInput include Base def input_name return method if seems_searchable? "#{method}_eq" end def input_html_options_name ...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/inputs/filters/text_input.rb
lib/active_admin/inputs/filters/text_input.rb
# frozen_string_literal: true module ActiveAdmin module Inputs module Filters class TextInput < ::Formtastic::Inputs::TextInput include Base include Base::SearchMethodSelect def input_html_options { cols: builder.default_text_area_width, rows: build...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/inputs/filters/select_input.rb
lib/active_admin/inputs/filters/select_input.rb
# frozen_string_literal: true module ActiveAdmin module Inputs module Filters class SelectInput < ::Formtastic::Inputs::SelectInput include Base def input_name return method if seems_searchable? searchable_method_name + (multiple? ? "_in" : "_eq") end d...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/lib/active_admin/inputs/filters/base/search_method_select.rb
lib/active_admin/inputs/filters/base/search_method_select.rb
# frozen_string_literal: true # This is a common set of Formtastic overrides needed to build a filter form # that lets you select from a set of search methods for a given attribute. # # Your class must declare available filters for this module to work. # Those filters must be recognizable by Ransack. For example: # # ...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/config/importmap.rb
config/importmap.rb
# frozen_string_literal: true pin "flowbite", preload: true # downloaded from https://cdn.jsdelivr.net/npm/flowbite@3.1.2/dist/flowbite.min.js pin "@rails/ujs", to: "rails_ujs_esm.js", preload: true # downloaded from https://cdn.jsdelivr.net/npm/@rails/ujs@7.1.501/+esm pin "active_admin", to: "active_admin.js", preload...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
github/scientist
https://github.com/github/scientist/blob/504a396e987f655a21c6bf2ed57935aadaa40859/test/test_helper.rb
test/test_helper.rb
require "minitest/autorun" $LOAD_PATH.unshift(File.expand_path(File.join(__dir__, "../lib"))) require "scientist"
ruby
MIT
504a396e987f655a21c6bf2ed57935aadaa40859
2026-01-04T15:39:32.880506Z
false
github/scientist
https://github.com/github/scientist/blob/504a396e987f655a21c6bf2ed57935aadaa40859/test/scientist_test.rb
test/scientist_test.rb
describe Scientist do it "has a version or whatever" do assert Scientist::VERSION end it "provides a helper to instantiate and run experiments" do obj = Object.new obj.extend(Scientist) r = obj.science "test" do |e| e.use { :control } e.try { :candidate } end assert_equal :c...
ruby
MIT
504a396e987f655a21c6bf2ed57935aadaa40859
2026-01-04T15:39:32.880506Z
false
github/scientist
https://github.com/github/scientist/blob/504a396e987f655a21c6bf2ed57935aadaa40859/test/scientist/result_test.rb
test/scientist/result_test.rb
describe Scientist::Result do before do @experiment = Scientist::Experiment.new "experiment" end it "is immutable" do control = Scientist::Observation.new("control", @experiment) candidate = Scientist::Observation.new("candidate", @experiment) result = Scientist::Result.new @experiment, [control...
ruby
MIT
504a396e987f655a21c6bf2ed57935aadaa40859
2026-01-04T15:39:32.880506Z
false
github/scientist
https://github.com/github/scientist/blob/504a396e987f655a21c6bf2ed57935aadaa40859/test/scientist/experiment_test.rb
test/scientist/experiment_test.rb
describe Scientist::Experiment do class Fake include Scientist::Experiment # Undo auto-config magic / preserve default behavior of Scientist::Experiment.new Scientist::Experiment.set_default(nil) def initialize(*args) end def enabled? true end attr_reader :published_result ...
ruby
MIT
504a396e987f655a21c6bf2ed57935aadaa40859
2026-01-04T15:39:32.880506Z
false
github/scientist
https://github.com/github/scientist/blob/504a396e987f655a21c6bf2ed57935aadaa40859/test/scientist/default_test.rb
test/scientist/default_test.rb
describe Scientist::Default do before do @ex = Scientist::Default.new "default" end it "is always disabled" do refute @ex.enabled? end it "noops publish" do assert_nil @ex.publish("data") end it "is an experiment" do assert Scientist::Default < Scientist::Experiment end it "reraise...
ruby
MIT
504a396e987f655a21c6bf2ed57935aadaa40859
2026-01-04T15:39:32.880506Z
false
github/scientist
https://github.com/github/scientist/blob/504a396e987f655a21c6bf2ed57935aadaa40859/test/scientist/observation_test.rb
test/scientist/observation_test.rb
describe Scientist::Observation do before do @experiment = Scientist::Experiment.new "test" end it "observes and records the execution of a block" do ob = Scientist::Observation.new("test", @experiment) do start_time = Time.now while Time.now - start_time < 0.1 # Perform some CPU-int...
ruby
MIT
504a396e987f655a21c6bf2ed57935aadaa40859
2026-01-04T15:39:32.880506Z
false
github/scientist
https://github.com/github/scientist/blob/504a396e987f655a21c6bf2ed57935aadaa40859/lib/scientist.rb
lib/scientist.rb
# Include this module into any class which requires science experiments in its # methods. Provides the `science` and `default_scientist_context` methods for # defining and running experiments. # # If you need to run science on class methods, extend this module instead. # # If including or extending this module are not ...
ruby
MIT
504a396e987f655a21c6bf2ed57935aadaa40859
2026-01-04T15:39:32.880506Z
false
github/scientist
https://github.com/github/scientist/blob/504a396e987f655a21c6bf2ed57935aadaa40859/lib/scientist/experiment.rb
lib/scientist/experiment.rb
# This mixin provides shared behavior for experiments. Includers must implement # `enabled?` and `publish(result)`. # # Override Scientist::Experiment.new to set your own class which includes and # implements Scientist::Experiment's interface. module Scientist::Experiment # Whether to raise when the control and cand...
ruby
MIT
504a396e987f655a21c6bf2ed57935aadaa40859
2026-01-04T15:39:32.880506Z
false
github/scientist
https://github.com/github/scientist/blob/504a396e987f655a21c6bf2ed57935aadaa40859/lib/scientist/version.rb
lib/scientist/version.rb
module Scientist VERSION = '1.6.5' end
ruby
MIT
504a396e987f655a21c6bf2ed57935aadaa40859
2026-01-04T15:39:32.880506Z
false
github/scientist
https://github.com/github/scientist/blob/504a396e987f655a21c6bf2ed57935aadaa40859/lib/scientist/default.rb
lib/scientist/default.rb
require "scientist/experiment" # A null experiment. class Scientist::Default include Scientist::Experiment attr_reader :name def initialize(name) @name = name end # Don't run experiments. def enabled? false end # Don't publish anything. def publish(result) end end
ruby
MIT
504a396e987f655a21c6bf2ed57935aadaa40859
2026-01-04T15:39:32.880506Z
false
github/scientist
https://github.com/github/scientist/blob/504a396e987f655a21c6bf2ed57935aadaa40859/lib/scientist/errors.rb
lib/scientist/errors.rb
module Scientist # Smoking in the bathroom and/or sassing. class BadBehavior < StandardError attr_reader :experiment attr_reader :name def initialize(experiment, name, message) @experiment = experiment @name = name super message end end class BehaviorMissing < BadBehavior ...
ruby
MIT
504a396e987f655a21c6bf2ed57935aadaa40859
2026-01-04T15:39:32.880506Z
false
github/scientist
https://github.com/github/scientist/blob/504a396e987f655a21c6bf2ed57935aadaa40859/lib/scientist/result.rb
lib/scientist/result.rb
# The immutable result of running an experiment. class Scientist::Result # An Array of candidate Observations. attr_reader :candidates # The control Observation to which the rest are compared. attr_reader :control # An Experiment. attr_reader :experiment # An Array of observations which didn't match t...
ruby
MIT
504a396e987f655a21c6bf2ed57935aadaa40859
2026-01-04T15:39:32.880506Z
false
github/scientist
https://github.com/github/scientist/blob/504a396e987f655a21c6bf2ed57935aadaa40859/lib/scientist/observation.rb
lib/scientist/observation.rb
# What happened when this named behavior was executed? Immutable. class Scientist::Observation # An Array of Exception types to rescue when initializing an observation. # NOTE: This Array will change to `[StandardError]` in the next major release. RESCUES = [Exception] # The experiment this observation is for...
ruby
MIT
504a396e987f655a21c6bf2ed57935aadaa40859
2026-01-04T15:39:32.880506Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/app/helpers/rails_admin/main_helper.rb
app/helpers/rails_admin/main_helper.rb
# frozen_string_literal: true module RailsAdmin module MainHelper def rails_admin_form_for(*args, &block) options = args.extract_options!.reverse_merge(builder: RailsAdmin::FormBuilder) (options[:html] ||= {})[:novalidate] ||= !RailsAdmin::Config.browser_validations form_for(*(args << options)...
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/app/helpers/rails_admin/form_builder.rb
app/helpers/rails_admin/form_builder.rb
# frozen_string_literal: true require 'nested_form/builder_mixin' module RailsAdmin class FormBuilder < ::ActionView::Helpers::FormBuilder include ::NestedForm::BuilderMixin include ::RailsAdmin::ApplicationHelper def generate(options = {}) without_field_error_proc_added_div do options.re...
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/app/helpers/rails_admin/application_helper.rb
app/helpers/rails_admin/application_helper.rb
# frozen_string_literal: true module RailsAdmin module ApplicationHelper def authorized?(action_name, abstract_model = nil, object = nil) object = nil if object.try :new_record? action(action_name, abstract_model, object).try(:authorized?) end def current_action params[:action].in?(%w[...
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/app/controllers/rails_admin/main_controller.rb
app/controllers/rails_admin/main_controller.rb
# frozen_string_literal: true module RailsAdmin class MainController < RailsAdmin::ApplicationController include ActionView::Helpers::TextHelper include RailsAdmin::MainHelper include RailsAdmin::ApplicationHelper before_action :check_for_cancel def bulk_action get_model process(par...
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/app/controllers/rails_admin/application_controller.rb
app/controllers/rails_admin/application_controller.rb
# frozen_string_literal: true require 'rails_admin/abstract_model' module RailsAdmin class ModelNotFound < ::StandardError end class ObjectNotFound < ::StandardError end class ActionNotAllowed < ::StandardError end class ApplicationController < Config.parent_controller.constantize include RailsAd...
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/factories.rb
spec/factories.rb
# frozen_string_literal: true FactoryBot.define do factory :player do sequence(:name) { |n| "Player #{n}" } sequence(:number) { |n| n } sequence(:position) { |n| "Position #{n}" } end factory :draft do date { 1.week.ago } sequence(:round) sequence(:pick) sequence(:overall) sequen...
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/policies.rb
spec/policies.rb
# frozen_string_literal: true class ApplicationPolicy attr_reader :user, :record def initialize(user, record) @user = user @record = record end def show? user.roles.include? :admin end def destroy? false end def history? user.roles.include? :admin end def show_in_app? u...
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/spec_helper.rb
spec/spec_helper.rb
# frozen_string_literal: true # Configure Rails Environment ENV['RAILS_ENV'] = 'test' CI_ORM = (ENV['CI_ORM'] || :active_record).to_sym PK_COLUMN = {active_record: :id, mongoid: :_id}[CI_ORM] if RUBY_ENGINE == 'jruby' # Workaround for JRuby CI failure https://github.com/jruby/jruby/issues/6547#issuecomment-77410499...
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/jobs/null_job.rb
spec/dummy_app/app/jobs/null_job.rb
# frozen_string_literal: true class NullJob < ApplicationJob queue_as :default def perform(*args) # Do nothing end end
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/jobs/application_job.rb
spec/dummy_app/app/jobs/application_job.rb
# frozen_string_literal: true class ApplicationJob < ActiveJob::Base # Automatically retry jobs that encountered a deadlock # retry_on ActiveRecord::Deadlocked # Most jobs are safe to ignore if the underlying records are no longer available # discard_on ActiveJob::DeserializationError end
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/mongoid/cms.rb
spec/dummy_app/app/mongoid/cms.rb
# frozen_string_literal: true module Cms def self.table_name_prefix 'cms_' end end
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/mongoid/restricted_team.rb
spec/dummy_app/app/mongoid/restricted_team.rb
# frozen_string_literal: true class RestrictedTeam < Team has_many :players, foreign_key: :team_id, dependent: :restrict_with_error end
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/mongoid/deeply_nested_field_test.rb
spec/dummy_app/app/mongoid/deeply_nested_field_test.rb
# frozen_string_literal: true class DeeplyNestedFieldTest include Mongoid::Document include Mongoid::Timestamps field :title, type: String belongs_to :nested_field_test, inverse_of: :deeply_nested_field_tests end
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/mongoid/managed_team.rb
spec/dummy_app/app/mongoid/managed_team.rb
# frozen_string_literal: true class ManagedTeam < Team belongs_to :user, class_name: 'ManagingUser', foreign_key: :manager, primary_key: :email, inverse_of: :teams end
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/mongoid/read_only_comment.rb
spec/dummy_app/app/mongoid/read_only_comment.rb
# frozen_string_literal: true class ReadOnlyComment < Comment def readonly? true end end
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/mongoid/managing_user.rb
spec/dummy_app/app/mongoid/managing_user.rb
# frozen_string_literal: true class ManagingUser < User has_one :team, class_name: 'ManagedTeam', foreign_key: :manager, primary_key: :email, inverse_of: :user has_many :teams, class_name: 'ManagedTeam', foreign_key: :manager, primary_key: :email, inverse_of: :user has_and_belongs_to_many :players, foreign_key: ...
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/mongoid/division.rb
spec/dummy_app/app/mongoid/division.rb
# frozen_string_literal: true class Division include Mongoid::Document include Mongoid::Timestamps field :name, type: String belongs_to :league, foreign_key: 'custom_league_id' has_many :teams validates_presence_of(:custom_league_id) validates_presence_of(:name) end
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/mongoid/carrierwave_uploader.rb
spec/dummy_app/app/mongoid/carrierwave_uploader.rb
# frozen_string_literal: true require 'mini_magick' class CarrierwaveUploader < CarrierWave::Uploader::Base # Include RMagick or ImageScience support: # include CarrierWave::RMagick include CarrierWave::MiniMagick # include CarrierWave::ImageScience # Choose what kind of storage to use for this uploader: ...
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/mongoid/league.rb
spec/dummy_app/app/mongoid/league.rb
# frozen_string_literal: true class League include Mongoid::Document field :name, type: String include Mongoid::Timestamps has_many :divisions, foreign_key: 'custom_league_id' validates_presence_of(:name) def custom_name "League '#{name}'" end end
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/mongoid/category.rb
spec/dummy_app/app/mongoid/category.rb
# frozen_string_literal: true class Category include Mongoid::Document belongs_to :parent_category, class_name: 'Category' end
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/mongoid/player.rb
spec/dummy_app/app/mongoid/player.rb
# frozen_string_literal: true class Player include Mongoid::Document include Mongoid::Timestamps include ActiveModel::ForbiddenAttributesProtection field :deleted_at, type: DateTime belongs_to :team, inverse_of: :players field :name, type: String field :position, type: String field :number, type: Inte...
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/mongoid/hardball.rb
spec/dummy_app/app/mongoid/hardball.rb
# frozen_string_literal: true class Hardball < Ball end
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/mongoid/comment.rb
spec/dummy_app/app/mongoid/comment.rb
# frozen_string_literal: true class Comment include Mongoid::Document field :content, type: String include Mongoid::Timestamps include Taggable belongs_to :commentable, polymorphic: true end
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/mongoid/draft.rb
spec/dummy_app/app/mongoid/draft.rb
# frozen_string_literal: true class Draft include Mongoid::Document include Mongoid::Timestamps belongs_to :player belongs_to :team field :date, type: Date field :round, type: Integer field :pick, type: Integer field :overall, type: Integer field :college, type: String field :notes, type: String ...
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/mongoid/fan.rb
spec/dummy_app/app/mongoid/fan.rb
# frozen_string_literal: true class Fan include Mongoid::Document include Mongoid::Timestamps field :name, type: String has_and_belongs_to_many :teams validates_presence_of(:name) end
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/mongoid/shrine_uploader.rb
spec/dummy_app/app/mongoid/shrine_uploader.rb
# frozen_string_literal: true class ShrineUploader < Shrine plugin :mongoid plugin :cached_attachment_data plugin :determine_mime_type plugin :pretty_location plugin :remove_attachment end
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/mongoid/team.rb
spec/dummy_app/app/mongoid/team.rb
# frozen_string_literal: true class Team include Mongoid::Document include Mongoid::Timestamps belongs_to :division field :name, type: String field :logo_url, type: String field :manager, type: String field :ballpark, type: String field :mascot, type: String field :founded, type: Integer field :wi...
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/mongoid/nested_field_test.rb
spec/dummy_app/app/mongoid/nested_field_test.rb
# frozen_string_literal: true class NestedFieldTest include Mongoid::Document field :title, type: String belongs_to :field_test, inverse_of: :nested_field_tests belongs_to :another_field_test, inverse_of: :nested_field_tests include Mongoid::Timestamps has_many :deeply_nested_field_tests, inverse_of: :ne...
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/mongoid/ball.rb
spec/dummy_app/app/mongoid/ball.rb
# frozen_string_literal: true class Ball include Mongoid::Document include Mongoid::Timestamps field :color, type: String has_one :comment, as: :commentable validates_presence_of :color, on: :create def to_param color.present? ? color.downcase.tr(' ', '-') : id end end
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/mongoid/another_field_test.rb
spec/dummy_app/app/mongoid/another_field_test.rb
# frozen_string_literal: true class AnotherFieldTest include Mongoid::Document has_many :nested_field_tests, inverse_of: :another_field_test end
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/mongoid/embed.rb
spec/dummy_app/app/mongoid/embed.rb
# frozen_string_literal: true class Embed include Mongoid::Document field :name, type: String embedded_in :field_test end
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/mongoid/shrine_versioning_uploader.rb
spec/dummy_app/app/mongoid/shrine_versioning_uploader.rb
# frozen_string_literal: true class ShrineVersioningUploader < Shrine plugin :mongoid plugin :cached_attachment_data plugin :determine_mime_type plugin :pretty_location plugin :remove_attachment if Gem.loaded_specs['shrine'].version >= Gem::Version.create('3') plugin :derivatives Attacher.deriva...
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/mongoid/image.rb
spec/dummy_app/app/mongoid/image.rb
# frozen_string_literal: true class Image include Mongoid::Document include Mongoid::Paperclip has_mongoid_attached_file :file, styles: {medium: '300x300>', thumb: '100x100>'} validates_attachment_presence :file end
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/mongoid/field_test.rb
spec/dummy_app/app/mongoid/field_test.rb
# frozen_string_literal: true require 'rails_admin/adapters/mongoid' class FieldTest include Mongoid::Document include Mongoid::Paperclip include ActiveModel::ForbiddenAttributesProtection extend Dragonfly::Model field :name, type: String field :title, type: String field :subject, type: String field ...
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/mongoid/user.rb
spec/dummy_app/app/mongoid/user.rb
# frozen_string_literal: true class User include Mongoid::Document include Mongoid::Paperclip include ActiveModel::ForbiddenAttributesProtection # Include default devise modules. Others available are: # :token_authenticatable, :confirmable, :lockable and :timeoutable devise :database_authenticatable, :regi...
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/mongoid/concerns/taggable.rb
spec/dummy_app/app/mongoid/concerns/taggable.rb
# frozen_string_literal: true module Taggable extend ActiveSupport::Concern # dummy end
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/mongoid/user/confirmed.rb
spec/dummy_app/app/mongoid/user/confirmed.rb
# frozen_string_literal: true class User class Confirmed < User end end
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/mongoid/comment/confirmed.rb
spec/dummy_app/app/mongoid/comment/confirmed.rb
# frozen_string_literal: true class Comment class Confirmed < Comment default_scope -> { where(content: 'something') } end end
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/mongoid/two_level/namespaced/polymorphic_association_test.rb
spec/dummy_app/app/mongoid/two_level/namespaced/polymorphic_association_test.rb
# frozen_string_literal: true module TwoLevel module Namespaced class PolymorphicAssociationTest include Mongoid::Document field :name, type: String has_many :comments, as: :commentable end end end
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/mongoid/cms/basic_page.rb
spec/dummy_app/app/mongoid/cms/basic_page.rb
# frozen_string_literal: true module Cms class BasicPage include Mongoid::Document field :title, type: String field :content, type: String include Mongoid::Timestamps validates :title, :content, presence: true end end
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/eager_loaded/basketball.rb
spec/dummy_app/app/eager_loaded/basketball.rb
# frozen_string_literal: true class Basketball < Ball end
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/controllers/players_controller.rb
spec/dummy_app/app/controllers/players_controller.rb
# frozen_string_literal: true class PlayersController < ApplicationController def show @player = Player.find(params[:id]) end end
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/controllers/application_controller.rb
spec/dummy_app/app/controllers/application_controller.rb
# frozen_string_literal: true class ApplicationController < ActionController::Base protect_from_forgery end
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/active_record/paper_trail_test.rb
spec/dummy_app/app/active_record/paper_trail_test.rb
# frozen_string_literal: true class PaperTrailTest < ActiveRecord::Base has_paper_trail end
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/active_record/fanship.rb
spec/dummy_app/app/active_record/fanship.rb
# frozen_string_literal: true if ActiveRecord.gem_version >= Gem::Version.new('7.1') || defined?(CompositePrimaryKeys) class Fanship < ActiveRecord::Base self.table_name = :fans_teams if defined?(CompositePrimaryKeys) self.primary_keys = :fan_id, :team_id else self.primary_key = :fan_id, :tea...
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/active_record/cms.rb
spec/dummy_app/app/active_record/cms.rb
# frozen_string_literal: true module Cms def self.table_name_prefix 'cms_' end end
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false
railsadminteam/rails_admin
https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/app/active_record/nested_favorite_player.rb
spec/dummy_app/app/active_record/nested_favorite_player.rb
# frozen_string_literal: true if ActiveRecord.gem_version >= Gem::Version.new('7.1') || defined?(CompositePrimaryKeys) class NestedFavoritePlayer < FavoritePlayer accepts_nested_attributes_for :fanship end end
ruby
MIT
d8e0809ea4b38415ace5b0d038fca317d805a3c1
2026-01-04T15:39:16.877032Z
false