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
thoughtbot/factory_bot
https://github.com/thoughtbot/factory_bot/blob/5115775355323252da65f323f6c10b91f2130d48/lib/factory_bot/evaluation.rb
lib/factory_bot/evaluation.rb
module FactoryBot class Evaluation def initialize(evaluator, attribute_assigner, to_create, observer) @evaluator = evaluator @attribute_assigner = attribute_assigner @to_create = to_create @observer = observer end delegate :object, :hash, to: :@attribute_assigner def create(r...
ruby
MIT
5115775355323252da65f323f6c10b91f2130d48
2026-01-04T15:39:01.421901Z
false
thoughtbot/factory_bot
https://github.com/thoughtbot/factory_bot/blob/5115775355323252da65f323f6c10b91f2130d48/lib/factory_bot/strategy_syntax_method_registrar.rb
lib/factory_bot/strategy_syntax_method_registrar.rb
module FactoryBot # @api private class StrategySyntaxMethodRegistrar def initialize(strategy_name) @strategy_name = strategy_name end def define_strategy_methods define_singular_strategy_method define_list_strategy_method define_pair_strategy_method end def self.with_in...
ruby
MIT
5115775355323252da65f323f6c10b91f2130d48
2026-01-04T15:39:01.421901Z
false
thoughtbot/factory_bot
https://github.com/thoughtbot/factory_bot/blob/5115775355323252da65f323f6c10b91f2130d48/lib/factory_bot/evaluator.rb
lib/factory_bot/evaluator.rb
require "active_support/core_ext/class/attribute" module FactoryBot # @api private class Evaluator class_attribute :attribute_lists private_instance_methods.each do |method| undef_method(method) unless method.match?(/^__|initialize/) end def initialize(build_strategy, overrides = {}) ...
ruby
MIT
5115775355323252da65f323f6c10b91f2130d48
2026-01-04T15:39:01.421901Z
false
thoughtbot/factory_bot
https://github.com/thoughtbot/factory_bot/blob/5115775355323252da65f323f6c10b91f2130d48/lib/factory_bot/decorator/invocation_tracker.rb
lib/factory_bot/decorator/invocation_tracker.rb
module FactoryBot class Decorator class InvocationTracker < Decorator def initialize(component) super @invoked_methods = [] end def method_missing(name, *args, &block) # rubocop:disable Style/MissingRespondToMissing @invoked_methods << name super end ...
ruby
MIT
5115775355323252da65f323f6c10b91f2130d48
2026-01-04T15:39:01.421901Z
false
thoughtbot/factory_bot
https://github.com/thoughtbot/factory_bot/blob/5115775355323252da65f323f6c10b91f2130d48/lib/factory_bot/decorator/attribute_hash.rb
lib/factory_bot/decorator/attribute_hash.rb
module FactoryBot class Decorator class AttributeHash < Decorator def initialize(component, attributes = []) super(component) @attributes = attributes end def attributes @attributes.each_with_object({}) do |attribute_name, result| result[attribute_name] = @comp...
ruby
MIT
5115775355323252da65f323f6c10b91f2130d48
2026-01-04T15:39:01.421901Z
false
thoughtbot/factory_bot
https://github.com/thoughtbot/factory_bot/blob/5115775355323252da65f323f6c10b91f2130d48/lib/factory_bot/decorator/new_constructor.rb
lib/factory_bot/decorator/new_constructor.rb
module FactoryBot class Decorator class NewConstructor < Decorator def initialize(component, build_class) super(component) @build_class = build_class end delegate :new, to: :@build_class end end end
ruby
MIT
5115775355323252da65f323f6c10b91f2130d48
2026-01-04T15:39:01.421901Z
false
thoughtbot/factory_bot
https://github.com/thoughtbot/factory_bot/blob/5115775355323252da65f323f6c10b91f2130d48/lib/factory_bot/decorator/disallows_duplicates_registry.rb
lib/factory_bot/decorator/disallows_duplicates_registry.rb
module FactoryBot class Decorator class DisallowsDuplicatesRegistry < Decorator def register(name, item) if registered?(name) raise DuplicateDefinitionError, "#{@component.name} already registered: #{name}" else @component.register(name, item) end end en...
ruby
MIT
5115775355323252da65f323f6c10b91f2130d48
2026-01-04T15:39:01.421901Z
false
thoughtbot/factory_bot
https://github.com/thoughtbot/factory_bot/blob/5115775355323252da65f323f6c10b91f2130d48/lib/factory_bot/declaration/dynamic.rb
lib/factory_bot/declaration/dynamic.rb
module FactoryBot class Declaration # @api private class Dynamic < Declaration def initialize(name, ignored = false, block = nil) super(name, ignored) @block = block end def ==(other) self.class == other.class && name == other.name && ignored == o...
ruby
MIT
5115775355323252da65f323f6c10b91f2130d48
2026-01-04T15:39:01.421901Z
false
thoughtbot/factory_bot
https://github.com/thoughtbot/factory_bot/blob/5115775355323252da65f323f6c10b91f2130d48/lib/factory_bot/declaration/implicit.rb
lib/factory_bot/declaration/implicit.rb
module FactoryBot class Declaration # @api private class Implicit < Declaration def initialize(name, factory = nil, ignored = false) super(name, ignored) @factory = factory end def ==(other) self.class == other.class && name == other.name && facto...
ruby
MIT
5115775355323252da65f323f6c10b91f2130d48
2026-01-04T15:39:01.421901Z
false
thoughtbot/factory_bot
https://github.com/thoughtbot/factory_bot/blob/5115775355323252da65f323f6c10b91f2130d48/lib/factory_bot/declaration/association.rb
lib/factory_bot/declaration/association.rb
module FactoryBot class Declaration # @api private class Association < Declaration def initialize(name, *options) super(name, false) @options = options.dup @overrides = options.extract_options! @factory_name = @overrides.delete(:factory) || name @traits = options ...
ruby
MIT
5115775355323252da65f323f6c10b91f2130d48
2026-01-04T15:39:01.421901Z
false
thoughtbot/factory_bot
https://github.com/thoughtbot/factory_bot/blob/5115775355323252da65f323f6c10b91f2130d48/lib/factory_bot/syntax/methods.rb
lib/factory_bot/syntax/methods.rb
module FactoryBot module Syntax ## This module is a container for all strategy methods provided by ## FactoryBot. This includes all the default strategies provided ({Methods#build}, ## {Methods#create}, {Methods#build_stubbed}, and {Methods#attributes_for}), as ## well as the complementary *_list and ...
ruby
MIT
5115775355323252da65f323f6c10b91f2130d48
2026-01-04T15:39:01.421901Z
false
thoughtbot/factory_bot
https://github.com/thoughtbot/factory_bot/blob/5115775355323252da65f323f6c10b91f2130d48/lib/factory_bot/syntax/default.rb
lib/factory_bot/syntax/default.rb
module FactoryBot module Syntax module Default include Methods def define(&block) DSL.run(block) end def modify(&block) ModifyDSL.run(block) end class DSL def factory(name, options = {}, &block) factory = Factory.new(name, options) ...
ruby
MIT
5115775355323252da65f323f6c10b91f2130d48
2026-01-04T15:39:01.421901Z
false
thoughtbot/factory_bot
https://github.com/thoughtbot/factory_bot/blob/5115775355323252da65f323f6c10b91f2130d48/lib/factory_bot/strategy/build.rb
lib/factory_bot/strategy/build.rb
module FactoryBot module Strategy class Build def association(runner) runner.run end def result(evaluation) evaluation.notify(:before_build, nil) evaluation.object.tap do |instance| evaluation.notify(:after_build, instance) end end def to_...
ruby
MIT
5115775355323252da65f323f6c10b91f2130d48
2026-01-04T15:39:01.421901Z
false
thoughtbot/factory_bot
https://github.com/thoughtbot/factory_bot/blob/5115775355323252da65f323f6c10b91f2130d48/lib/factory_bot/strategy/attributes_for.rb
lib/factory_bot/strategy/attributes_for.rb
module FactoryBot module Strategy class AttributesFor def association(runner) runner.run(:null) end def result(evaluation) evaluation.hash end def to_sym :attributes_for end end end end
ruby
MIT
5115775355323252da65f323f6c10b91f2130d48
2026-01-04T15:39:01.421901Z
false
thoughtbot/factory_bot
https://github.com/thoughtbot/factory_bot/blob/5115775355323252da65f323f6c10b91f2130d48/lib/factory_bot/strategy/stub.rb
lib/factory_bot/strategy/stub.rb
module FactoryBot module Strategy class Stub @@next_id = 1000 DISABLED_PERSISTENCE_METHODS = [ :connection, :decrement!, :delete, :destroy!, :destroy, :increment!, :reload, :save!, :save, :toggle!, :touch, ...
ruby
MIT
5115775355323252da65f323f6c10b91f2130d48
2026-01-04T15:39:01.421901Z
false
thoughtbot/factory_bot
https://github.com/thoughtbot/factory_bot/blob/5115775355323252da65f323f6c10b91f2130d48/lib/factory_bot/strategy/null.rb
lib/factory_bot/strategy/null.rb
module FactoryBot module Strategy class Null def association(runner) end def result(evaluation) end def to_sym :null end end end end
ruby
MIT
5115775355323252da65f323f6c10b91f2130d48
2026-01-04T15:39:01.421901Z
false
thoughtbot/factory_bot
https://github.com/thoughtbot/factory_bot/blob/5115775355323252da65f323f6c10b91f2130d48/lib/factory_bot/strategy/create.rb
lib/factory_bot/strategy/create.rb
module FactoryBot module Strategy class Create def association(runner) runner.run end def result(evaluation) evaluation.notify(:before_build, nil) evaluation.object.tap do |instance| evaluation.notify(:after_build, instance) evaluation.notify(:before...
ruby
MIT
5115775355323252da65f323f6c10b91f2130d48
2026-01-04T15:39:01.421901Z
false
thoughtbot/factory_bot
https://github.com/thoughtbot/factory_bot/blob/5115775355323252da65f323f6c10b91f2130d48/lib/factory_bot/attribute/dynamic.rb
lib/factory_bot/attribute/dynamic.rb
module FactoryBot class Attribute # @api private class Dynamic < Attribute def initialize(name, ignored, block) super(name, ignored) @block = block end def to_proc block = @block -> { value = case block.arity when 1, -1, -2 then instance_...
ruby
MIT
5115775355323252da65f323f6c10b91f2130d48
2026-01-04T15:39:01.421901Z
false
thoughtbot/factory_bot
https://github.com/thoughtbot/factory_bot/blob/5115775355323252da65f323f6c10b91f2130d48/lib/factory_bot/attribute/sequence.rb
lib/factory_bot/attribute/sequence.rb
module FactoryBot class Attribute # @api private class Sequence < Attribute def initialize(name, sequence, ignored) super(name, ignored) @sequence = sequence end def to_proc sequence = @sequence -> { FactoryBot.generate(sequence) } end end end end...
ruby
MIT
5115775355323252da65f323f6c10b91f2130d48
2026-01-04T15:39:01.421901Z
false
thoughtbot/factory_bot
https://github.com/thoughtbot/factory_bot/blob/5115775355323252da65f323f6c10b91f2130d48/lib/factory_bot/attribute/association.rb
lib/factory_bot/attribute/association.rb
module FactoryBot class Attribute # @api private class Association < Attribute attr_reader :factory def initialize(name, factory, overrides) super(name, false) @factory = factory @overrides = overrides end def to_proc factory = @factory overrid...
ruby
MIT
5115775355323252da65f323f6c10b91f2130d48
2026-01-04T15:39:01.421901Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/misc/bug_report_template.rb
misc/bug_report_template.rb
begin require "bundler/inline" rescue LoadError => e $stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler" raise e end gemfile(true) do source "https://rubygems.org" # Activate the gem you are reporting the issue against. gem "railties", "5.0.1" gem "activerecord", "5.0.1" ...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/test/test_helper.rb
test/test_helper.rb
# frozen_string_literal: true $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.join(Gem.loaded_specs['kaminari-core'].gem_dir, 'test')) $LOAD_PATH.unshift(File.dirname(__FILE__)) ENV['RAILS_ENV'] ||= 'test' ENV['DB'] ||= 'sqlite3' # require logger before requiring rails, or ...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-core/test/fake_gem.rb
kaminari-core/test/fake_gem.rb
# frozen_string_literal: true module Kaminari module FakeGem extend ActiveSupport::Concern module ClassMethods def inherited(kls) super def kls.fake_gem_defined_method; end end end end end ActiveSupport.on_load :active_record do ActiveRecord::Base.send :include, Kaminari...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-core/test/requests/navigation_test.rb
kaminari-core/test/requests/navigation_test.rb
# frozen_string_literal: true require 'test_helper' class NavigationTest < Test::Unit::TestCase include Capybara::DSL setup do 1.upto(100) {|i| User.create! name: "user#{'%03d' % i}" } Capybara.current_driver = :rack_test end teardown do Capybara.reset_sessions! Capybara.use_default_driver ...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-core/test/requests/request_format_test.rb
kaminari-core/test/requests/request_format_test.rb
# frozen_string_literal: true require 'test_helper' class RenderingWithFormatOptionTest < Test::Unit::TestCase include Capybara::DSL setup do User.create! name: 'user1' end teardown do Capybara.reset_sessions! Capybara.use_default_driver User.delete_all end test "Make sure that kaminari...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-core/test/helpers/action_view_extension_test.rb
kaminari-core/test/helpers/action_view_extension_test.rb
# frozen_string_literal: true require 'test_helper' if defined?(::Rails::Railtie) && defined?(::ActionView) class ActionViewExtensionTest < ActionView::TestCase setup do self.output_buffer = ::ActionView::OutputBuffer.new I18n.available_locales = [:en, :de, :fr] I18n.locale = :en end t...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-core/test/helpers/tags_test.rb
kaminari-core/test/helpers/tags_test.rb
# frozen_string_literal: true require 'test_helper' if defined?(::Rails::Railtie) && defined?(ActionView) class TagTest < ActionView::TestCase sub_test_case '#page_url_for' do setup do self.params[:controller] = 'users' self.params[:action] = 'index' end sub_test_case 'for...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-core/test/helpers/paginator_tags_test.rb
kaminari-core/test/helpers/paginator_tags_test.rb
# frozen_string_literal: true require 'test_helper' if defined? ::Kaminari::Actionview class PaginatorTagsTest < ActionView::TestCase # A test paginator that can detect instantiated tags inside class TagSpy < Kaminari::Helpers::Paginator def initialize(*, **) super @tags = [] end...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-core/test/helpers/helpers_test.rb
kaminari-core/test/helpers/helpers_test.rb
# frozen_string_literal: true require 'test_helper' class PaginatorHelperTest < ActiveSupport::TestCase include Kaminari::Helpers def template stub(r = Object.new) do render.with_any_args params { {} } options { {} } url_for {|h| "/foo?page=#{h[:page]}"} link_to { "<a href='#'>l...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-core/test/models/array_test.rb
kaminari-core/test/models/array_test.rb
# frozen_string_literal: true require 'test_helper' class PaginatableArrayTest < ActiveSupport::TestCase setup do @array = Kaminari::PaginatableArray.new((1..100).to_a) end test 'initial state' do assert_equal 0, Kaminari::PaginatableArray.new.count end test 'specifying limit and offset when initi...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-core/test/models/configuration_methods_test.rb
kaminari-core/test/models/configuration_methods_test.rb
# frozen_string_literal: true require 'test_helper' class ConfigurationMethodsTest < ActiveSupport::TestCase sub_test_case '#default_per_page' do if defined? ActiveRecord test 'AR::Base should be not polluted by configuration methods' do assert_not_respond_to ActiveRecord::Base, :paginates_per ...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-core/test/models/active_record/paginable_without_count_test.rb
kaminari-core/test/models/active_record/paginable_without_count_test.rb
# frozen_string_literal: true require 'test_helper' if defined? ActiveRecord class PaginableWithoutCountTest < ActiveSupport::TestCase def self.startup 26.times { User.create! } super end def self.shutdown User.delete_all super end test 'it does not make count queries a...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-core/test/models/active_record/inherited_test.rb
kaminari-core/test/models/active_record/inherited_test.rb
# frozen_string_literal: true require 'test_helper' if defined? ActiveRecord class ActiveRecordModelExtensionTest < ActiveSupport::TestCase test 'An AR model responds to Kaminari defined methods' do assert_respond_to Class.new(ActiveRecord::Base), :page end test "Kaminari doesn't prevent other AR...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-core/test/models/active_record/scopes_test.rb
kaminari-core/test/models/active_record/scopes_test.rb
# frozen_string_literal: true require 'test_helper' if defined? ActiveRecord class ActiveRecordModelExtensionTest < ActiveSupport::TestCase test 'Changing page_method_name' do begin Kaminari.configure {|config| config.page_method_name = :per_page_kaminari } model = Class.new ActiveRecord:...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-core/test/models/active_record/active_record_relation_methods_test.rb
kaminari-core/test/models/active_record/active_record_relation_methods_test.rb
# frozen_string_literal: true require 'test_helper' if defined? ActiveRecord class ActiveRecordRelationMethodsTest < ActiveSupport::TestCase sub_test_case '#total_count' do setup do @author = User.create! name: 'author' @author2 = User.create! name: 'author2' @author3 = User.create...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-core/test/generators/views_generator_test.rb
kaminari-core/test/generators/views_generator_test.rb
# frozen_string_literal: true require 'test_helper' if defined?(::Rails::Railtie) && ENV['GENERATOR_SPEC'] require 'rails/generators' require 'generators/kaminari/views_generator' class GitHubApiHelperTest < ::Test::Unit::TestCase test '.get_files_in_master' do assert_include Kaminari::Generators::Gi...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-core/test/config/config_test.rb
kaminari-core/test/config/config_test.rb
# frozen_string_literal: true require 'test_helper' class ConfigurationTest < ::Test::Unit::TestCase sub_test_case 'default_per_page' do test 'by default' do assert_equal 25, Kaminari.config.default_per_page end test 'configured via config block' do begin Kaminari.configure {|c| c.de...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-core/test/fake_app/rails_app.rb
kaminari-core/test/fake_app/rails_app.rb
# frozen_string_literal: true # require 'rails/all' require 'action_controller/railtie' require 'action_view/railtie' require 'active_record/railtie' if defined? ActiveRecord # config class KaminariTestApp < Rails::Application config.load_defaults "#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}" if config.respon...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-core/test/fake_app/active_record/models.rb
kaminari-core/test/fake_app/active_record/models.rb
# frozen_string_literal: true # models class User < ActiveRecord::Base has_many :authorships has_many :readerships has_many :books_authored, through: :authorships, source: :book has_many :books_read, through: :readerships, source: :book has_many :addresses, class_name: 'User::Address' def readers User...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-core/lib/generators/kaminari/config_generator.rb
kaminari-core/lib/generators/kaminari/config_generator.rb
# frozen_string_literal: true module Kaminari module Generators # rails g kaminari:config class ConfigGenerator < Rails::Generators::Base # :nodoc: source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates')) desc <<DESC Description: Copies Kaminari configuration file to your...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-core/lib/generators/kaminari/views_generator.rb
kaminari-core/lib/generators/kaminari/views_generator.rb
# frozen_string_literal: true module Kaminari module Generators # rails g kaminari:views THEME class ViewsGenerator < Rails::Generators::NamedBase # :nodoc: source_root File.expand_path('../../../../app/views/kaminari', __FILE__) class_option :template_engine, type: :string, aliases: '-e', desc:...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-core/lib/generators/kaminari/templates/kaminari_config.rb
kaminari-core/lib/generators/kaminari/templates/kaminari_config.rb
# frozen_string_literal: true Kaminari.configure do |config| # config.default_per_page = 25 # config.max_per_page = nil # config.window = 4 # config.outer_window = 0 # config.left = 0 # config.right = 0 # config.page_method_name = :page # config.param_name = :page # config.max_pages = nil # config....
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-core/lib/kaminari/core.rb
kaminari-core/lib/kaminari/core.rb
# frozen_string_literal: true module Kaminari def self.deprecator @deprecator ||= ActiveSupport::Deprecation.new("2.0", "kaminari-core") end end # load Rails/Railtie begin require 'rails' rescue LoadError #do nothing end # load Kaminari components require 'kaminari/config' require 'kaminari/exceptions' r...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-core/lib/kaminari/exceptions.rb
kaminari-core/lib/kaminari/exceptions.rb
# frozen_string_literal: true module Kaminari class ZeroPerPageOperation < ZeroDivisionError; end end
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-core/lib/kaminari/railtie.rb
kaminari-core/lib/kaminari/railtie.rb
# frozen_string_literal: true module Kaminari class Railtie < ::Rails::Railtie #:nodoc: # Doesn't actually do anything. Just keeping this hook point, mainly for compatibility initializer 'kaminari' do end end end
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-core/lib/kaminari/config.rb
kaminari-core/lib/kaminari/config.rb
# frozen_string_literal: true module Kaminari # Configures global settings for Kaminari # Kaminari.configure do |config| # config.default_per_page = 10 # end class << self def configure yield config end def config @_config ||= Config.new end end class Config attr...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-core/lib/kaminari/engine.rb
kaminari-core/lib/kaminari/engine.rb
# frozen_string_literal: true module Kaminari #:nodoc: class Engine < ::Rails::Engine #:nodoc: initializer :deprecator do |app| app.deprecators[:kaminari] = Kaminari.deprecator if app.respond_to?(:deprecators) end end end
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-core/lib/kaminari/helpers/helper_methods.rb
kaminari-core/lib/kaminari/helpers/helper_methods.rb
# frozen_string_literal: true module Kaminari module Helpers # The Kaminari::Helpers::UrlHelper module provides useful methods for # generating a path or url to a particular page. A class must implement the # following methods: # # * <tt>url_for</tt>: A method that generates an actual path ...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-core/lib/kaminari/helpers/paginator.rb
kaminari-core/lib/kaminari/helpers/paginator.rb
# frozen_string_literal: true require 'active_support/inflector' require 'kaminari/helpers/tags' module Kaminari module Helpers # The main container tag class Paginator < Tag def initialize(template, window: nil, outer_window: Kaminari.config.outer_window, left: Kaminari.config.left, right: Kaminari.c...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-core/lib/kaminari/helpers/tags.rb
kaminari-core/lib/kaminari/helpers/tags.rb
# frozen_string_literal: true module Kaminari module Helpers PARAM_KEY_EXCEPT_LIST = [:authenticity_token, :commit, :utf8, :_method, :script_name, :original_script_name].freeze # A tag stands for an HTML tag inside the paginator. # Basically, a tag has its own partial template file, so every tag can be ...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-core/lib/kaminari/models/configuration_methods.rb
kaminari-core/lib/kaminari/models/configuration_methods.rb
# frozen_string_literal: true require 'active_support/concern' module Kaminari module ConfigurationMethods #:nodoc: extend ActiveSupport::Concern module ClassMethods #:nodoc: # Overrides the default +per_page+ value per model # class Article < ActiveRecord::Base # paginates_per 10 ...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-core/lib/kaminari/models/array_extension.rb
kaminari-core/lib/kaminari/models/array_extension.rb
# frozen_string_literal: true require 'active_support/core_ext/module' module Kaminari # Kind of Array that can paginate class PaginatableArray < Array include Kaminari::ConfigurationMethods::ClassMethods ENTRY = 'entry'.freeze attr_internal_accessor :limit_value, :offset_value # ==== Options ...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-core/lib/kaminari/models/page_scope_methods.rb
kaminari-core/lib/kaminari/models/page_scope_methods.rb
# frozen_string_literal: true module Kaminari module PageScopeMethods # Specify the <tt>per_page</tt> value for the preceding <tt>page</tt> scope # Model.page(3).per(10) def per(num, max_per_page: nil) max_per_page ||= ((defined?(@_max_per_page) && @_max_per_page) || self.max_per_page) @_pe...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-core/lib/kaminari/core/version.rb
kaminari-core/lib/kaminari/core/version.rb
# frozen_string_literal: true module Kaminari module Core VERSION = '1.2.2' end end
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-actionview/lib/kaminari/actionview.rb
kaminari-actionview/lib/kaminari/actionview.rb
# frozen_string_literal: true require "kaminari/actionview/version" require 'active_support/lazy_load_hooks' ActiveSupport.on_load :action_view do require 'kaminari/helpers/helper_methods' ::ActionView::Base.send :include, Kaminari::Helpers::HelperMethods require 'kaminari/actionview/action_view_extension' end...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-actionview/lib/kaminari/actionview/version.rb
kaminari-actionview/lib/kaminari/actionview/version.rb
# frozen_string_literal: true module Kaminari module Actionview VERSION = '1.2.2' end end
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-actionview/lib/kaminari/actionview/action_view_extension.rb
kaminari-actionview/lib/kaminari/actionview/action_view_extension.rb
# frozen_string_literal: true require 'action_view/log_subscriber' require 'action_view/context' require 'kaminari/helpers/paginator' module Kaminari # = Helpers module ActionViewExtension # Monkey-patching AV::LogSubscriber not to log each render_partial module LogSubscriberSilencer def render_par...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/lib/kaminari.rb
lib/kaminari.rb
# frozen_string_literal: true require 'kaminari/core' require 'kaminari/version' require 'kaminari/actionview' require 'kaminari/activerecord'
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/lib/kaminari/version.rb
lib/kaminari/version.rb
# frozen_string_literal: true module Kaminari VERSION = '1.2.2' end
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-activerecord/lib/kaminari/activerecord.rb
kaminari-activerecord/lib/kaminari/activerecord.rb
# frozen_string_literal: true require "kaminari/activerecord/version" require 'active_support/lazy_load_hooks' ActiveSupport.on_load :active_record do require 'kaminari/core' require 'kaminari/activerecord/active_record_extension' ::ActiveRecord::Base.send :include, Kaminari::ActiveRecordExtension end
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-activerecord/lib/kaminari/activerecord/active_record_model_extension.rb
kaminari-activerecord/lib/kaminari/activerecord/active_record_model_extension.rb
# frozen_string_literal: true require 'kaminari/activerecord/active_record_relation_methods' module Kaminari module ActiveRecordModelExtension extend ActiveSupport::Concern included do include Kaminari::ConfigurationMethods # Fetch the values at the specified page number # Model.page(5...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-activerecord/lib/kaminari/activerecord/version.rb
kaminari-activerecord/lib/kaminari/activerecord/version.rb
# frozen_string_literal: true module Kaminari module Activerecord VERSION = '1.2.2' end end
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-activerecord/lib/kaminari/activerecord/active_record_relation_methods.rb
kaminari-activerecord/lib/kaminari/activerecord/active_record_relation_methods.rb
# frozen_string_literal: true module Kaminari # Active Record specific page scope methods implementations module ActiveRecordRelationMethods # Used for page_entry_info def entry_name(options = {}) default = options[:count] == 1 ? model_name.human : model_name.human.pluralize model_name.human(op...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
kaminari/kaminari
https://github.com/kaminari/kaminari/blob/55d6e40767442d206236d3718c5bdb32d01f2345/kaminari-activerecord/lib/kaminari/activerecord/active_record_extension.rb
kaminari-activerecord/lib/kaminari/activerecord/active_record_extension.rb
# frozen_string_literal: true require 'kaminari/activerecord/active_record_model_extension' module Kaminari module ActiveRecordExtension extend ActiveSupport::Concern module ClassMethods #:nodoc: # Future subclasses will pick up the model extension def inherited(kls) #:nodoc: super ...
ruby
MIT
55d6e40767442d206236d3718c5bdb32d01f2345
2026-01-04T15:38:55.939543Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/tasks/test_application.rb
tasks/test_application.rb
# frozen_string_literal: true require "fileutils" module ActiveAdmin class TestApplication attr_reader :rails_env, :template def initialize(opts = {}) @rails_env = opts[:rails_env] || "test" @template = opts[:template] || "rails_template" end def soft_generate if File.exist? app_d...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/tasks/bug_report_template.rb
tasks/bug_report_template.rb
# frozen_string_literal: true require "bundler/inline" gemfile(true) do source "https://rubygems.org" # Use `ACTIVE_ADMIN_PATH=. ruby tasks/bug_report_template.rb` to run # locally, otherwise run against the default branch. if ENV["ACTIVE_ADMIN_PATH"] gem "activeadmin", path: ENV["ACTIVE_ADMIN_PATH"], req...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/app/helpers/active_admin/form_helper.rb
app/helpers/active_admin/form_helper.rb
# frozen_string_literal: true module ActiveAdmin module FormHelper RESERVED_PARAMS = %w(controller action commit utf8).freeze def active_admin_form_for(resource, options = {}, &block) Arbre::Context.new({}, self) do active_admin_form_for resource, options, &block end.content end ...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/app/helpers/active_admin/layout_helper.rb
app/helpers/active_admin/layout_helper.rb
# frozen_string_literal: true module ActiveAdmin module LayoutHelper # Returns the current Active Admin application instance def active_admin_application ActiveAdmin.application end def set_page_title(title) @page_title = title end def site_title # Prioritize namespace and ...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/app/helpers/active_admin/index_helper.rb
app/helpers/active_admin/index_helper.rb
# frozen_string_literal: true module ActiveAdmin module IndexHelper def scope_name(scope) case scope.name when Proc then self.instance_exec(&scope.name).to_s else scope.name.to_s end end def batch_actions_to_display @batch_actions_to_display ||= begin ...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/app/helpers/active_admin/display_helper.rb
app/helpers/active_admin/display_helper.rb
# frozen_string_literal: true module ActiveAdmin module DisplayHelper DISPLAY_NAME_FALLBACK = -> { klass = self.class name = if klass.respond_to?(:model_name) if klass.respond_to?(:primary_key) "#{klass.model_name.human} ##{send(klass.primary_key)}" else ...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/app/helpers/active_admin/breadcrumb_helper.rb
app/helpers/active_admin/breadcrumb_helper.rb
# frozen_string_literal: true module ActiveAdmin module BreadcrumbHelper ID_FORMAT_REGEXP = /\A(\d+|[a-f0-9]{24}|(?:[a-f0-9]{8}-(?:[a-f0-9]{4}-){3}[a-f0-9]{12}))\z/.freeze # Returns an array of links to use in a breadcrumb def build_breadcrumb_links(path = request.path, html_options = {}) config = ...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/app/helpers/active_admin/auto_link_helper.rb
app/helpers/active_admin/auto_link_helper.rb
# frozen_string_literal: true module ActiveAdmin module AutoLinkHelper # Automatically links objects to their resource controllers. If # the resource has not been registered, a string representation of # the object is returned. # # The default content in the link is returned from ActiveAdmin::Disp...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/app/controllers/active_admin/page_controller.rb
app/controllers/active_admin/page_controller.rb
# frozen_string_literal: true module ActiveAdmin # All Pages controllers inherit from this controller. class PageController < BaseController # Active admin actions don't require layout. All custom actions do. ACTIVE_ADMIN_ACTIONS = [:index] actions :index before_action :authorize_access! d...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/app/controllers/active_admin/resource_controller.rb
app/controllers/active_admin/resource_controller.rb
# frozen_string_literal: true require "active_admin/collection_decorator" module ActiveAdmin # All Resources Controller inherits from this controller. # It implements actions and helpers for resources. class ResourceController < BaseController respond_to :html, :xml, :json respond_to :csv, only: :index ...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/app/controllers/active_admin/base_controller.rb
app/controllers/active_admin/base_controller.rb
# frozen_string_literal: true module ActiveAdmin # BaseController for ActiveAdmin. # It implements ActiveAdmin controllers core features. class BaseController < ::InheritedResources::Base helper MethodOrProcHelper helper LayoutHelper helper FormHelper helper BreadcrumbHelper helper AutoLinkHel...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/app/controllers/active_admin/base_controller/menu.rb
app/controllers/active_admin/base_controller/menu.rb
# frozen_string_literal: true module ActiveAdmin class BaseController < ::InheritedResources::Base module Menu extend ActiveSupport::Concern included do before_action :set_current_menu_item helper_method :current_menu helper_method :current_menu_item? end protect...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/app/controllers/active_admin/base_controller/authorization.rb
app/controllers/active_admin/base_controller/authorization.rb
# frozen_string_literal: true module ActiveAdmin class BaseController < ::InheritedResources::Base module Authorization extend ActiveSupport::Concern ACTIONS_DICTIONARY = { index: ActiveAdmin::Authorization::READ, show: ActiveAdmin::Authorization::READ, new: ActiveAdmin::Autho...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/app/controllers/active_admin/resource_controller/resource_class_methods.rb
app/controllers/active_admin/resource_controller/resource_class_methods.rb
# frozen_string_literal: true module ActiveAdmin class ResourceController < BaseController module ResourceClassMethods # Override the default `resource_class` class and instance # methods to only return the class defined in the instance # of ActiveAdmin::Resource def override_resource_cla...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/app/controllers/active_admin/resource_controller/data_access.rb
app/controllers/active_admin/resource_controller/data_access.rb
# frozen_string_literal: true module ActiveAdmin class ResourceController < BaseController # This module overrides most of the data access methods in Inherited # Resources to provide Active Admin with it's data. # # The module also deals with authorization and resource callbacks. # module Dat...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/app/controllers/active_admin/resource_controller/scoping.rb
app/controllers/active_admin/resource_controller/scoping.rb
# frozen_string_literal: true module ActiveAdmin class ResourceController < BaseController # This module deals with scoping entire controllers to a relation module Scoping extend ActiveSupport::Concern protected # Override the default InheritedResource #begin_of_association_chain to allow...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/app/controllers/active_admin/resource_controller/streaming.rb
app/controllers/active_admin/resource_controller/streaming.rb
# frozen_string_literal: true require "csv" module ActiveAdmin class ResourceController < BaseController # This module overrides CSV responses to allow large data downloads. # Could be expanded to JSON and XML in the future. # module Streaming def index super do |format| for...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/app/controllers/active_admin/resource_controller/polymorphic_routes.rb
app/controllers/active_admin/resource_controller/polymorphic_routes.rb
# frozen_string_literal: true require "active_admin/resource" require "active_admin/resource/model" module ActiveAdmin class ResourceController < BaseController module PolymorphicRoutes def polymorphic_url(record_or_hash_or_array, options = {}) super(map_named_resources_for(record_or_hash_or_array)...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/app/controllers/active_admin/resource_controller/action_builder.rb
app/controllers/active_admin/resource_controller/action_builder.rb
# frozen_string_literal: true module ActiveAdmin class ResourceController < BaseController module ActionBuilder extend ActiveSupport::Concern module ClassMethods def clear_member_actions! remove_action_methods(:member) active_admin_config.clear_member_actions! en...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/app/controllers/active_admin/resource_controller/decorators.rb
app/controllers/active_admin/resource_controller/decorators.rb
# frozen_string_literal: true module ActiveAdmin class ResourceController < BaseController module Decorators protected def apply_decorator(resource) decorate? ? decorator_class.new(resource) : resource end def apply_collection_decorator(collection) if decorate? ...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/features/support/rails.rb
features/support/rails.rb
# frozen_string_literal: true require "cucumber/rails/application" require "cucumber/rails/action_dispatch" require "cucumber/rails/world" require "cucumber/rails/hooks" require "cucumber/rails/capybara" require "cucumber/rails/database/strategy" require "cucumber/rails/database/deletion_strategy" require "cucumber/rai...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/features/support/simplecov_regular_env.rb
features/support/simplecov_regular_env.rb
# frozen_string_literal: true if ENV["COVERAGE"] == "true" require "simplecov" SimpleCov.command_name ["regular features", ENV["TEST_ENV_NUMBER"]].join(" ").rstrip end require_relative "env"
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/features/support/simplecov_changes_env.rb
features/support/simplecov_changes_env.rb
# frozen_string_literal: true if ENV["COVERAGE"] == "true" require "simplecov" SimpleCov.command_name "filesystem changes features" end require_relative "env"
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/features/support/env.rb
features/support/env.rb
# frozen_string_literal: true ENV["RAILS_ENV"] = "test" require "simplecov" if ENV["COVERAGE"] == "true" Dir["#{File.expand_path('../step_definitions', __dir__)}/*.rb"].each do |f| require f end require_relative "../../tasks/test_application" require "#{ActiveAdmin::TestApplication.new.full_app_dir}/config/enviro...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/features/support/paths.rb
features/support/paths.rb
# frozen_string_literal: true module NavigationHelpers # Maps a name to a path. Used by the # # When /^I go to (.+)$/ do |page_name| # # step definition in web_steps.rb # def path_to(page_name) case page_name when /the dashboard/ "/admin" when /the new post page/ "/admin/posts/n...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/features/support/simplecov_reload_env.rb
features/support/simplecov_reload_env.rb
# frozen_string_literal: true if ENV["COVERAGE"] == "true" require "simplecov" SimpleCov.command_name "reload features" end require_relative "env"
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/features/step_definitions/root_steps.rb
features/step_definitions/root_steps.rb
# frozen_string_literal: true Around "@root" do |scenario, block| previous_root = ActiveAdmin.application.root_to begin block.call ensure ActiveAdmin.application.root_to = previous_root end end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/features/step_definitions/i18n_steps.rb
features/step_definitions/i18n_steps.rb
# frozen_string_literal: true When(/^I set my locale to "([^"]*)"$/) do |lang| I18n.locale = lang end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/features/step_definitions/factory_steps.rb
features/step_definitions/factory_steps.rb
# frozen_string_literal: true def create_user(name, type = "User") first_name, last_name = name.split(" ") type.camelize.constantize.where(first_name: first_name, last_name: last_name).first_or_create(username: name.tr(" ", "").underscore) end Given(/^(a|\d+)( published)?( unstarred|starred)? posts?(?: with the ti...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/features/step_definitions/action_item_steps.rb
features/step_definitions/action_item_steps.rb
# frozen_string_literal: true Then(/^I should see an action item link to "([^"]*)"$/) do |link| expect(page).to have_css("[data-test-action-items] > a", text: link) end Then(/^I should not see an action item link to "([^"]*)"$/) do |link| expect(page).to have_no_css("[data-test-action-items] > a", text: link) end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/features/step_definitions/format_steps.rb
features/step_definitions/format_steps.rb
# frozen_string_literal: true require "csv" Around "@csv" do |scenario, block| default_csv_options = ActiveAdmin.application.csv_options default_disable_streaming_in = ActiveAdmin.application.disable_streaming_in begin block.call ensure ActiveAdmin.application.disable_streaming_in = default_disable_st...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/features/step_definitions/web_steps.rb
features/step_definitions/web_steps.rb
# frozen_string_literal: true require "uri" require File.expand_path(File.join(__dir__, "..", "support", "paths")) module WithinHelpers def with_scope(locator) locator ? within(*selector_for(locator)) { yield } : yield end private def selector_for(locator) case locator # Add more mappings here. ...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/features/step_definitions/pagination_steps.rb
features/step_definitions/pagination_steps.rb
# frozen_string_literal: true Then(/^I should not see pagination$/) do expect(page).to have_no_css "[data-test-pagination]" end Then(/^I should see pagination page (\d+) link$/) do |num| expect(page).to have_css "[data-test-pagination] a", text: num, count: 1 end Then(/^I should see the pagination "Next" link/) d...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/features/step_definitions/table_steps.rb
features/step_definitions/table_steps.rb
# frozen_string_literal: true Then(/^I should see (\d+) ([\w]*) in the table$/) do |count, resource_type| expect(page).to have_css(".data-table tr > td:first-child", count: count.to_i) end Then("I should see {string} in the table") do |string| expect(page).to have_css(".data-table tr > td", text: string) end Then...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/features/step_definitions/configuration_steps.rb
features/step_definitions/configuration_steps.rb
# frozen_string_literal: true module ActiveAdminReloading def load_aa_config(config_content) ActiveSupport::Notifications.instrument ActiveAdmin::Application::BeforeLoadEvent, { active_admin_application: ActiveAdmin.application } eval(config_content) ActiveSupport::Notifications.instrument ActiveAdmin::Ap...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/features/step_definitions/additional_web_steps.rb
features/step_definitions/additional_web_steps.rb
# frozen_string_literal: true Then(/^I should see a table header with "([^"]*)"$/) do |content| expect(page).to have_xpath "//th", text: content end Then(/^I should not see a table header with "([^"]*)"$/) do |content| expect(page).to have_no_xpath "//th", text: content end Then(/^I should see a sortable table he...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false