- Ruby 2.6.5
- [Rails 6.x]
To install add the gem in your Gemfile. This will downgrade some rails behavior to look like Rails 4 (for which behaviors are downgraded see lib/strainer/behaviors)
Adding a behavior:
Basic behavior looks like this (needs to be place in lib/strainer/behaviors):
module Strainer
module Behaviors
# Comment describing the override
class {{BehaviorClassName}} < Strainer::RuntimeBehavior
module {{ModuleThatImplementsOverride}}
include Strainer::Logable
def uniq(value = true)
# The strainer_log method is used to dump data identifying the kind of rails
# incompatibility and the source location along with extra payload data
strainer_log('BEHAVIOR_IDENTIFIER', custom: { CUSTOM_DATA_KEY: 'CUSTOM_DATA_VALUE' })
distinct(value)
end
end
def apply_patch!
# Place code here that patches rails behavior
# eg. to add this behavior to ActiveRecord::Relation do:
# ActiveRecord::Relation.include({{ModuleThatImplementsOverride}})
end
end
end
end
# To enable the patch onload of the railtie add this behavior in patches.rb
def self.setup!(component)
case component
when :action_controller
load_behaviors Behaviors::ParametersAsHash
when :active_record
load_behaviors(
Behaviors::ForcedReloading,
Behaviors::RelationDelegationChanges,
Behaviors::FinderChanges,
Behaviors::RelationQueryMethodChanges,
{{*Behaviors::BehaviorClassName*}},
)
end
end
TBD
Read Semantic Versioning for details. Briefly, it means:
- Major (X.y.z) - Incremented for any backwards incompatible public API changes.
- Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
- Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
Please note that this project is released with a CODE OF CONDUCT. By participating in this project you agree to abide by its terms.
Read CONTRIBUTING for details.
Copyright 2019 . Read LICENSE for details.
Read CHANGES for details. Built with Gemsmith.
Developed by Rishab Govind at .