-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds support for horizontally sharded database projects (#1079)
* take a configurable base class * make base_class instance method * adds tests * adds initializer install rake task * better base_class default * more sensible default initializer * add sensible tests * reduce test overhead * updates changelog * make base_class= simpler * improve test clarity * original default class
- Loading branch information
1 parent
a524b98
commit b4eed9b
Showing
8 changed files
with
87 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# This works because the classes where the base class is a concern, Tag and Tagging | ||
# are autoloaded, and won't be started until after the initializers run. | ||
|
||
# ActsAsTaggableOn.base_class = ApplicationRecord |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
namespace :acts_as_taggable_on do | ||
|
||
namespace :sharded_db do | ||
|
||
desc "Install initializer setting custom base class" | ||
task :install_initializer => [:environment, "config/initializers/foo"] do | ||
source = File.join( | ||
Gem.loaded_specs["acts-as-taggable-on"].full_gem_path, | ||
"lib", | ||
"tasks", | ||
"examples", | ||
"acts_as_taggable_on.rb.example" | ||
) | ||
|
||
destination = "config/initializers/acts_as_taggable_on.rb" | ||
|
||
cp source, destination | ||
end | ||
|
||
directory "config/initializers" | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters