source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/db/migrate/20110901131551_change_division_primary_key.rb | Ruby | mit | 7,954 | master | 500 | # frozen_string_literal: true
class ChangeDivisionPrimaryKey < ActiveRecord::Migration[5.0]
def up
drop_table :divisions
create_table :divisions, primary_key: 'custom_id' do |t|
t.timestamps null: false
t.integer :league_id
t.string :name, limit: 50, null: false
end
end
def down
... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/db/migrate/20220416102741_create_composite_key_tables.rb | Ruby | mit | 7,954 | master | 410 | # frozen_string_literal: true
class CreateCompositeKeyTables < ActiveRecord::Migration[6.0]
def change
add_column :fans_teams, :since, :date
create_table :favorite_players, primary_key: %i[fan_id team_id player_id] do |t|
t.integer :fan_id, null: false
t.integer :team_id, null: false
t.int... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/db/migrate/20190531065324_create_action_text_tables.action_text.rb | Ruby | mit | 7,954 | master | 448 | # frozen_string_literal: true
class CreateActionTextTables < ActiveRecord::Migration[5.0]
def change
create_table :action_text_rich_texts do |t|
t.string :name, null: false
t.text :body, size: :long
t.references :record, null: false, polymorphic: true, index: false
t.timestamps... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/db/migrate/00000000000009_create_fans_teams_migration.rb | Ruby | mit | 7,954 | master | 256 | # frozen_string_literal: true
class CreateFansTeamsMigration < ActiveRecord::Migration[5.0]
def self.up
create_table :fans_teams, id: false do |t|
t.integer :fan_id, :team_id
end
end
def self.down
drop_table :fans_teams
end
end |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/db/migrate/20171229220713_add_enum_fields_to_field_tests.rb | Ruby | mit | 7,954 | master | 234 | # frozen_string_literal: true
class AddEnumFieldsToFieldTests < ActiveRecord::Migration[5.0]
def change
add_column :field_tests, :string_enum_field, :string
add_column :field_tests, :integer_enum_field, :integer
end
end |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/db/migrate/00000000000014_add_color_to_team_migration.rb | Ruby | mit | 7,954 | master | 211 | # frozen_string_literal: true
class AddColorToTeamMigration < ActiveRecord::Migration[5.0]
def self.up
add_column :teams, :color, :string
end
def self.down
remove_column :teams, :color
end
end |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/db/migrate/20110607152842_add_format_to_field_test.rb | Ruby | mit | 7,954 | master | 222 | # frozen_string_literal: true
class AddFormatToFieldTest < ActiveRecord::Migration[5.0]
def self.up
add_column :field_tests, :format, :string
end
def self.down
remove_column :field_tests, :format
end
end |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/db/migrate/20181029101829_add_shrine_data_to_field_tests.rb | Ruby | mit | 7,954 | master | 238 | # frozen_string_literal: true
class AddShrineDataToFieldTests < ActiveRecord::Migration[5.0]
def change
add_column :field_tests, :shrine_asset_data, :text
add_column :field_tests, :shrine_versioning_asset_data, :text
end
end |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/db/migrate/20110901150912_set_primary_key_not_null_for_divisions.rb | Ruby | mit | 7,954 | master | 563 | # frozen_string_literal: true
class SetPrimaryKeyNotNullForDivisions < ActiveRecord::Migration[5.0]
def up
drop_table :divisions
create_table :divisions, id: false do |t|
t.timestamps null: false
t.primary_key :custom_id
t.integer :custom_league_id
t.string :name, limit: 50, null: fal... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/mongoid/league.rb | Ruby | mit | 7,954 | master | 271 | # 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 |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/mongoid/shrine_uploader.rb | Ruby | mit | 7,954 | master | 201 | # frozen_string_literal: true
class ShrineUploader < Shrine
plugin :mongoid
plugin :cached_attachment_data
plugin :determine_mime_type
plugin :pretty_location
plugin :remove_attachment
end |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/mongoid/user.rb | Ruby | mit | 7,954 | master | 1,870 | # 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... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/mongoid/shrine_versioning_uploader.rb | Ruby | mit | 7,954 | master | 498 | # 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... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/mongoid/ball.rb | Ruby | mit | 7,954 | master | 293 | # 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 |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/mongoid/managing_user.rb | Ruby | mit | 7,954 | master | 448 | # 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: ... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/mongoid/carrierwave_uploader.rb | Ruby | mit | 7,954 | master | 1,467 | # 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:
... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/mongoid/field_test.rb | Ruby | mit | 7,954 | master | 2,513 | # 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 ... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/mongoid/nested_field_test.rb | Ruby | mit | 7,954 | master | 598 | # 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... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/mongoid/draft.rb | Ruby | mit | 7,954 | master | 634 | # 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
... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/mongoid/player.rb | Ruby | mit | 7,954 | master | 1,123 | # 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... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/mongoid/deeply_nested_field_test.rb | Ruby | mit | 7,954 | master | 223 | # 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 |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/mongoid/comment.rb | Ruby | mit | 7,954 | master | 203 | # frozen_string_literal: true
class Comment
include Mongoid::Document
field :content, type: String
include Mongoid::Timestamps
include Taggable
belongs_to :commentable, polymorphic: true
end |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/mongoid/image.rb | Ruby | mit | 7,954 | master | 226 | # 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 |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/mongoid/team.rb | Ruby | mit | 7,954 | master | 1,571 | # 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... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/mongoid/division.rb | Ruby | mit | 7,954 | master | 285 | # 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 |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/mongoid/two_level/namespaced/polymorphic_association_test.rb | Ruby | mit | 7,954 | master | 231 | # 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 |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/mongoid/cms/basic_page.rb | Ruby | mit | 7,954 | master | 244 | # 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 |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/active_record/fanship.rb | Ruby | mit | 7,954 | master | 758 | # 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... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/active_record/shrine_versioning_uploader.rb | Ruby | mit | 7,954 | master | 503 | # frozen_string_literal: true
class ShrineVersioningUploader < Shrine
plugin :activerecord
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.d... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/active_record/managing_user.rb | Ruby | mit | 7,954 | master | 275 | # 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
end |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/active_record/fan.rb | Ruby | mit | 7,954 | master | 309 | # frozen_string_literal: true
class Fan < ActiveRecord::Base
has_and_belongs_to_many :teams
if ActiveRecord.gem_version >= Gem::Version.new('7.1') || defined?(CompositePrimaryKeys)
has_many :fanships, inverse_of: :fan
has_one :fanship, inverse_of: :fan
end
validates_presence_of(:name)
end |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/active_record/ball.rb | Ruby | mit | 7,954 | master | 225 | # frozen_string_literal: true
class Ball < ActiveRecord::Base
has_one :comment, as: :commentable
validates_presence_of :color, on: :create
def to_param
color.present? ? color.downcase.tr(' ', '-') : id
end
end |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/active_record/user.rb | Ruby | mit | 7,954 | master | 753 | # frozen_string_literal: true
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable, :lockable and :timeoutable
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable
if ActiveRecord.gem_ve... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/active_record/nested_field_test.rb | Ruby | mit | 7,954 | master | 546 | # frozen_string_literal: true
class NestedFieldTest < ActiveRecord::Base
belongs_to :field_test, optional: true, inverse_of: :nested_field_tests
belongs_to :another_field_test, optional: true, inverse_of: :nested_field_tests
has_one :comment, as: :commentable
has_many :deeply_nested_field_tests, inverse_of: :n... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/active_record/shrine_uploader.rb | Ruby | mit | 7,954 | master | 206 | # frozen_string_literal: true
class ShrineUploader < Shrine
plugin :activerecord
plugin :cached_attachment_data
plugin :determine_mime_type
plugin :pretty_location
plugin :remove_attachment
end |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/active_record/nested_fan.rb | Ruby | mit | 7,954 | master | 241 | # frozen_string_literal: true
if ActiveRecord.gem_version >= Gem::Version.new('7.1') || defined?(CompositePrimaryKeys)
class NestedFan < Fan
accepts_nested_attributes_for :fanships
accepts_nested_attributes_for :fanship
end
end |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/active_record/player.rb | Ruby | mit | 7,954 | master | 880 | # frozen_string_literal: true
class Player < ActiveRecord::Base
belongs_to :team, optional: true, inverse_of: :players
has_one :draft, dependent: :destroy
has_many :comments, as: :commentable
validates_presence_of(:name)
validates_numericality_of(:number, only_integer: true)
validates_uniqueness_of(:numbe... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/active_record/league.rb | Ruby | mit | 7,954 | master | 350 | # frozen_string_literal: true
class League < ActiveRecord::Base
has_many :divisions, foreign_key: 'custom_league_id'
has_many :teams, -> { readonly }, through: :divisions
has_many :players, through: :teams
has_one :division, foreign_key: 'custom_league_id'
validates_presence_of(:name)
def custom_name
... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/active_record/field_test.rb | Ruby | mit | 7,954 | master | 1,915 | # frozen_string_literal: true
class FieldTest < ActiveRecord::Base
has_many :nested_field_tests, dependent: :destroy, inverse_of: :field_test
accepts_nested_attributes_for :nested_field_tests, allow_destroy: true
has_one :comment, as: :commentable
accepts_nested_attributes_for :comment, allow_destroy: true
... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/active_record/team.rb | Ruby | mit | 7,954 | master | 1,211 | # frozen_string_literal: true
class Team < ActiveRecord::Base
has_many :players, -> { order :id }, inverse_of: :team
has_and_belongs_to_many :fans
has_many :comments, as: :commentable
validates_numericality_of :division_id, only_integer: true
validates_presence_of :manager
validates_numericality_of :found... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/active_record/nested_favorite_player.rb | Ruby | mit | 7,954 | master | 219 | # 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 |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/active_record/draft.rb | Ruby | mit | 7,954 | master | 427 | # frozen_string_literal: true
class Draft < ActiveRecord::Base
belongs_to :team
belongs_to :player
validates_numericality_of(:player_id, only_integer: true)
validates_numericality_of(:team_id, only_integer: true)
validates_presence_of(:date)
validates_numericality_of(:round, only_integer: true)
validate... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/active_record/division.rb | Ruby | mit | 7,954 | master | 291 | # frozen_string_literal: true
class Division < ActiveRecord::Base
self.primary_key = :custom_id
belongs_to :league, foreign_key: 'custom_league_id', optional: true
has_many :teams
validates_numericality_of(:custom_league_id, only_integer: true)
validates_presence_of(:name)
end |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/active_record/favorite_player.rb | Ruby | mit | 7,954 | master | 660 | # frozen_string_literal: true
if ActiveRecord.gem_version >= Gem::Version.new('7.1') || defined?(CompositePrimaryKeys)
class FavoritePlayer < ActiveRecord::Base
if defined?(CompositePrimaryKeys)
self.primary_keys = :fan_id, :team_id, :player_id
else
self.primary_key = :fan_id, :team_id, :player_i... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/app/jobs/application_job.rb | Ruby | mit | 7,954 | master | 300 | # 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 |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/config/application.rb | Ruby | mit | 7,954 | master | 2,792 | # frozen_string_literal: true
require File.expand_path('boot', __dir__)
require 'action_controller/railtie'
require 'action_mailer/railtie'
begin
require CI_ORM.to_s
require "#{CI_ORM}/railtie"
rescue LoadError
# ignore errors
end
require 'active_storage/engine' if CI_ORM == :active_record
require 'action_tex... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/config/boot.rb | Ruby | mit | 7,954 | master | 359 | # frozen_string_literal: true
CI_ORM = (ENV['CI_ORM'] || :active_record).to_sym unless defined?(CI_ORM)
CI_TARGET_ORMS = %i[active_record mongoid].freeze
CI_ASSET = (ENV['CI_ASSET'] || :sprockets).to_sym unless defined?(CI_ASSET)
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
require 'bundler/setup... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/config/routes.rb | Ruby | mit | 7,954 | master | 261 | # frozen_string_literal: true
DummyApp::Application.routes.draw do
# Needed for :show_in_app tests
resources :players, only: [:show]
devise_for :users
mount RailsAdmin::Engine => '/admin', as: 'rails_admin'
root to: 'rails_admin/main#dashboard'
end |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/config/importmap.rails_admin.rb | Ruby | mit | 7,954 | master | 1,368 | # frozen_string_literal: true
# Pin npm packages by running ./bin/importmap
pin 'rails_admin', preload: true
pin 'rails_admin/src/rails_admin/base', to: 'rails_admin/base.js'
pin '@hotwired/turbo', to: 'https://ga.jspm.io/npm:@hotwired/turbo@7.1.0/dist/turbo.es2017-esm.js'
pin '@hotwired/turbo-rails', to: 'https://ga... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/config/importmap.rb | Ruby | mit | 7,954 | master | 520 | # frozen_string_literal: true
# Pin npm packages by running ./bin/importmap
pin 'application', preload: true
pin '@hotwired/turbo-rails', to: 'https://ga.jspm.io/npm:@hotwired/turbo-rails@7.1.3/app/javascript/turbo/index.js'
pin '@rails/ujs', to: 'https://ga.jspm.io/npm:@rails/ujs@6.0.5/lib/assets/compiled/rails-ujs.... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/config/initializers/dragonfly.rb | Ruby | mit | 7,954 | master | 530 | # frozen_string_literal: true
require 'dragonfly'
# Logger
Dragonfly.logger = Rails.logger
# Configure
Dragonfly.app.configure do
plugin :imagemagick
protect_from_dos_attacks true
secret '904547b2be647f0e11a76933b3220d6bd2fb83f380ac760125e4daa3b9504b4e'
url_format '/media/:job/:name'
datastore(:file,
... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/config/initializers/devise.rb | Ruby | mit | 7,954 | master | 12,802 | # frozen_string_literal: true
# Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render inv... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/config/initializers/session_patch.rb | Ruby | mit | 7,954 | master | 609 | # frozen_string_literal: true
require 'action_dispatch/middleware/session/abstract_store'
# When ORM was switched, but another ORM's model class still exists in session
# (Devise saves User model to session), ActionDispatch raises ActionDispatch::Session::SessionRestoreError
# and app can't be started unless you dele... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/config/initializers/cookies_serializer.rb | Ruby | mit | 7,954 | master | 304 | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# This is a new Rails 5.0 default, so introduced as a config to ensure apps made with earlier versions of Rails aren't affected when upgrading.
Rails.application.config.action_dispatch.cookies_serializer = :json |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/config/initializers/backtrace_silencers.rb | Ruby | mit | 7,954 | master | 435 | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/config/initializers/assets.rb | Ruby | mit | 7,954 | master | 727 | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0' if Rails.application.config.respond_to?(:assets)
# Add additional assets to the asset load path
# Rail... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/config/initializers/cors.rb | Ruby | mit | 7,954 | master | 535 | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Avoid CORS issues when API is called from the frontend app.
# Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin AJAX requests.
# Read more: https://github.com/cyu/rack-cors
# Rails.application.confi... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/config/initializers/wrap_parameters.rb | Ruby | mit | 7,954 | master | 549 | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_con... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/config/initializers/inflections.rb | Ruby | mit | 7,954 | master | 678 | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflec... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/config/initializers/rails_admin.rb | Ruby | mit | 7,954 | master | 575 | # frozen_string_literal: true
RailsAdmin.config do |c|
c.asset_source = CI_ASSET
c.model Team do
include_all_fields
field :color, :hidden
end
if Rails.env.production?
# Live demo configuration
c.main_app_name = ['RailsAdmin', 'Live Demo']
c.included_models = %w[Comment Division Draft Fan F... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/config/initializers/secret_token.rb | Ruby | mit | 7,954 | master | 693 | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words ... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/config/initializers/mongoid.rb | Ruby | mit | 7,954 | master | 245 | # frozen_string_literal: true
if CI_ORM == :mongoid
filename =
if Mongoid.respond_to?(:belongs_to_required_by_default=)
'mongoid6.yml'
else
'mongoid5.yml'
end
::Mongoid.load!(Rails.root.join('config', filename))
end |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/config/initializers/filter_parameter_logging.rb | Ruby | mit | 7,954 | master | 225 | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password] |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/config/environments/test.rb | Ruby | mit | 7,954 | master | 2,036 | # frozen_string_literal: true
DummyApp::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database i... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/config/environments/development.rb | Ruby | mit | 7,954 | master | 2,253 | # frozen_string_literal: true
DummyApp::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/dummy_app/config/environments/production.rb | Ruby | mit | 7,954 | master | 3,605 | # frozen_string_literal: true
DummyApp::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memor... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/orm/active_record.rb | Ruby | mit | 7,954 | master | 3,108 | # frozen_string_literal: true
require 'rails_admin/adapters/active_record'
ActiveRecord::Base.connection.data_sources.each do |table|
ActiveRecord::Base.connection.drop_table(table)
end
def silence_stream(stream)
old_stream = stream.dup
stream.reopen(/mswin|mingw/.match?(RbConfig::CONFIG['host_os']) ? 'NUL:' :... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/orm/mongoid.rb | Ruby | mit | 7,954 | master | 469 | # frozen_string_literal: true
require 'rails_admin/adapters/mongoid'
Paperclip.logger = Logger.new(nil)
class Tableless
include Mongoid::Document
class << self
def column(name, sql_type = 'string', default = nil, _null = true)
# ignore length
sql_type = sql_type.to_s.sub(/\(.*\)/, '').to_sym
... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/rails_admin/install_generator_spec.rb | Ruby | mit | 7,954 | master | 4,382 | # frozen_string_literal: true
require 'spec_helper'
require 'generators/rails_admin/install_generator'
RSpec.describe RailsAdmin::InstallGenerator, type: :generator do
destination File.expand_path('../dummy_app/tmp/generator', __dir__)
arguments ['admin', "--asset=#{CI_ASSET}", '--force']
before do
prepare... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/rails_admin/active_record_extension_spec.rb | Ruby | mit | 7,954 | master | 575 | # frozen_string_literal: true
require 'spec_helper'
require File.expand_path('../../config/initializers/active_record_extensions', __dir__)
RSpec.describe 'ActiveRecord::Base', active_record: true do
describe '#safe_send' do
it 'only calls #read_attribute once' do
@player = Player.new
@player.number... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/rails_admin/version_spec.rb | Ruby | mit | 7,954 | master | 1,857 | # frozen_string_literal: true
require 'fileutils'
require 'spec_helper'
RSpec.describe 'RailsAdmin::Version' do
describe '#warn_with_js_version' do
it 'does nothing when the versions match' do
allow(RailsAdmin::Version).to receive(:actual_js_version).and_return('3.0.0')
allow(RailsAdmin::Version).to... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/rails_admin/abstract_model_spec.rb | Ruby | mit | 7,954 | master | 6,719 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::AbstractModel do
describe '.all' do
it 'returns abstract models for all models' do
expect(RailsAdmin::AbstractModel.all.map(&:model)).to include Player, Team
end
it 'does not pick up a model without table', active_reco... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/rails_admin/config_spec.rb | Ruby | mit | 7,954 | master | 13,555 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::Config do
describe '.included_models' do
it 'only uses included models' do
RailsAdmin.config.included_models = [Team, League]
expect(RailsAdmin::AbstractModel.all.collect(&:model)).to eq([League, Team]) # it gets sorted
... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/rails_admin/engine_spec.rb | Ruby | mit | 7,954 | master | 915 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::Engine do
context 'on class unload' do
let(:fields) { RailsAdmin.config(Player).edit.fields }
before do
Rails.application.config.cache_classes = false
RailsAdmin.config(Player) do
field :name
field :nu... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/rails_admin/support/hash_helper_spec.rb | Ruby | mit | 7,954 | master | 1,007 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::HashHelper do
let(:hash) do
{
'subject' => 'Test',
'user' => {
name: 'Dirk',
'title' => 'Holistic Detective',
'clients' => [
{name: 'Zaphod'},
{'name' => 'Arthur'},
],
... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/rails_admin/support/csv_converter_spec.rb | Ruby | mit | 7,954 | master | 4,888 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::CSVConverter do
it 'keeps headers ordering' do
RailsAdmin.config(Player) do
export do
field :number
field :name
end
end
FactoryBot.create :player
objects = Player.all
schema = {only: %i[nu... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/rails_admin/support/datetime_spec.rb | Ruby | mit | 7,954 | master | 1,009 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::Support::Datetime do
describe '#to_flatpickr_format' do
{
'%D de %M de %Y, %H:%M:%S' => 'm/d/y \d\e i \d\e Y, H:i:S',
'%d/%-m/%Y, %H:%M:%S' => 'd/n/Y, H:i:S',
'%d de %B de %Y' => 'd \d\e F \d\e Y',
'%-d %B %Y'... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/rails_admin/extentions/cancancan/authorization_adapter_spec.rb | Ruby | mit | 7,954 | master | 756 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::Extensions::CanCanCan::AuthorizationAdapter do
let(:user) { double }
let(:controller) { double(_current_user: user, current_ability: MyAbility.new(user)) }
class MyAbility
include CanCan::Ability
def initialize(_user)
... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/rails_admin/extentions/paper_trail/auditing_adapter_spec.rb | Ruby | mit | 7,954 | master | 1,513 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::Extensions::PaperTrail::AuditingAdapter, active_record: true do
let(:controller) { double(set_paper_trail_whodunnit: nil) }
describe '#initialize' do
it 'accepts the user and version classes as arguments' do
adapter = descri... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/rails_admin/extentions/paper_trail/version_proxy_spec.rb | Ruby | mit | 7,954 | master | 623 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::Extensions::PaperTrail::VersionProxy, active_record: true do
describe '#username' do
subject { described_class.new(version, user_class).username }
let(:version) { double(whodunnit: :the_user) }
let(:user_class) { double(find... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/rails_admin/config/configurable_spec.rb | Ruby | mit | 7,954 | master | 908 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::Config::Configurable do
class ConfigurableTest
include RailsAdmin::Config::Configurable
register_instance_option :foo do
'default'
end
end
subject { ConfigurableTest.new }
describe 'recursion tracking' do
i... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/rails_admin/config/lazy_model_spec.rb | Ruby | mit | 7,954 | master | 1,906 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::Config::LazyModel do
subject { RailsAdmin::Config::LazyModel.new(:Team, &block) }
let(:block) { proc { register_instance_option('parameter') } } # an arbitrary instance method we can spy on
describe '#initialize' do
it "doesn't ... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/rails_admin/config/const_load_suppressor_spec.rb | Ruby | mit | 7,954 | master | 852 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::Config::ConstLoadSuppressor do
describe '.suppressing' do
it 'suppresses constant loading' do
expect do
subject.suppressing { UnknownConstant }
end.not_to raise_error
end
it 'raises the error on recursion... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/rails_admin/config/actions_spec.rb | Ruby | mit | 7,954 | master | 6,678 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::Config::Actions do
describe 'default' do
it 'is as before' do
expect(RailsAdmin::Config::Actions.all.collect(&:key)).to eq(%i[dashboard index show new edit export delete bulk_delete history_show history_index show_in_app])
... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/rails_admin/config/model_spec.rb | Ruby | mit | 7,954 | master | 5,409 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::Config::Model do
describe '#excluded?' do
before do
RailsAdmin.config do |config|
config.included_models = [Comment]
end
end
it 'returns false when included, true otherwise' do
allow(RailsAdmin::Abs... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/rails_admin/config/has_fields_spec.rb | Ruby | mit | 7,954 | master | 2,990 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::Config::HasFields do
it 'shows hidden fields when added through the DSL' do
expect(RailsAdmin.config(Team).fields.detect { |f| f.name == :division_id }).not_to be_visible
RailsAdmin.config do |config|
config.model Team do
... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/rails_admin/config/proxyable_spec.rb | Ruby | mit | 7,954 | master | 1,299 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::Config::Proxyable do
class ProxyableTest
include RailsAdmin::Config::Proxyable
def boo
sleep 0.15
bindings[:foo]
end
def qux
'foobar'
end
end
let!(:proxyable_test) { ProxyableTest.new }
subj... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/rails_admin/config/fields_spec.rb | Ruby | mit | 7,954 | master | 568 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::Config::Fields, mongoid: true do
describe '.factory for self.referentials belongs_to' do
it 'associates belongs_to _id foreign_key to a belongs_to association' do
class MongoTree
include Mongoid::Document
has_ma... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/rails_admin/config/has_description_spec.rb | Ruby | mit | 7,954 | master | 384 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::Config::HasDescription do
it 'shows description message when added through the DSL' do
RailsAdmin.config do |config|
config.model Team do
desc 'Description of Team model'
end
end
expect(RailsAdmin.config(... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/rails_admin/config/sections_spec.rb | Ruby | mit | 7,954 | master | 3,951 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::Config::Sections do
describe 'configure' do
it 'configures without changing the section default list' do
RailsAdmin.config Team do
edit do
configure :name do
label 'Renamed'
end
e... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/rails_admin/config/fields/base_spec.rb | Ruby | mit | 7,954 | master | 24,524 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::Config::Fields::Base do
describe '#required' do
it 'reads the on: :create/:update validate option' do
RailsAdmin.config Ball do
field 'color'
end
expect(RailsAdmin.config('Ball').fields.first.with(object: B... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/rails_admin/config/fields/association_spec.rb | Ruby | mit | 7,954 | master | 5,382 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::Config::Fields::Association do
describe '#pretty_value' do
let(:player) { FactoryBot.create(:player, name: '<br />', team: FactoryBot.create(:team)) }
let(:field) { RailsAdmin.config('Team').fields.detect { |f| f.name == :players... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/rails_admin/config/fields/types/bson_object_id_spec.rb | Ruby | mit | 7,954 | master | 729 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::Config::Fields::Types::BsonObjectId do
it_behaves_like 'a generic field type', :string_field, :bson_object_id
describe '#parse_value' do
let(:bson) { RailsAdmin::Adapters::Mongoid::Bson::OBJECT_ID.new }
let(:field) do
Ra... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/rails_admin/config/fields/types/carrierwave_spec.rb | Ruby | mit | 7,954 | master | 732 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::Config::Fields::Types::Carrierwave do
it_behaves_like 'a generic field type', :string_field, :carrierwave
describe '#thumb_method' do
before do
RailsAdmin.config FieldTest do
field :carrierwave_asset, :carrierwave
... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/rails_admin/config/fields/types/password_spec.rb | Ruby | mit | 7,954 | master | 880 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::Config::Fields::Types::Password do
it_behaves_like 'a generic field type', :string_field, :password
describe '#parse_input' do
let(:field) do
RailsAdmin.config(User).fields.detect do |f|
f.name == :password
end... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/rails_admin/config/fields/types/has_one_association_spec.rb | Ruby | mit | 7,954 | master | 208 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::Config::Fields::Types::HasOneAssociation do
it_behaves_like 'a generic field type', :integer_field, :has_one_association
end |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/rails_admin/config/fields/types/multiple_active_storage_spec.rb | Ruby | mit | 7,954 | master | 6,290 | # frozen_string_literal: true
require 'spec_helper'
if defined?(ActiveStorage)
RSpec.describe RailsAdmin::Config::Fields::Types::MultipleActiveStorage do
it_behaves_like 'a generic field type', :string_field, :multiple_active_storage
let(:record) { FactoryBot.create :field_test }
let(:field) do
R... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/rails_admin/config/fields/types/date_spec.rb | Ruby | mit | 7,954 | master | 3,144 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::Config::Fields::Types::Date do
it_behaves_like 'a generic field type', :date_field, :date
describe '#formatted_value' do
it 'gets object value' do
field = RailsAdmin.config(FieldTest).fields.detect do |f|
f.name == :... |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/rails_admin/config/fields/types/ck_editor_spec.rb | Ruby | mit | 7,954 | master | 257 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::Config::Fields::Types::CKEditor do
it_behaves_like 'a generic field type', :text_field, :ck_editor
it_behaves_like 'a string-like field type', :text_field, :ck_editor
end |
github | railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin | spec/rails_admin/config/fields/types/code_mirror_spec.rb | Ruby | mit | 7,954 | master | 263 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::Config::Fields::Types::CodeMirror do
it_behaves_like 'a generic field type', :text_field, :code_mirror
it_behaves_like 'a string-like field type', :text_field, :code_mirror
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.