flip
flip copied to clipboard
Allow strategy to be called on arbitrary classes
Prior to this change, it attempt to use the hardcoded Feature
class,
whether or not it exists.
So, when I attempted to namespace my Feature class I got the following error:
NameError: uninitialized constant Flip::DatabaseStrategy::Feature
/Users/jcoyne/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/flip-1.1.0/lib/flip/database_strategy.rb:5:in
`initialize'
/Users/jcoyne/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/flip-1.1.0/lib/flip/feature_set.rb:36:in
`new'
/Users/jcoyne/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/flip-1.1.0/lib/flip/feature_set.rb:36:in
`add_strategy'
/Users/jcoyne/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/flip-1.1.0/lib/flip/declarable.rb:15:in
`strategy'
/Users/jcoyne/workspace/curation_concerns/app/models/curation_concerns/feature.rb:6:in
`<class:Feature>'
@pda Do you have any feedback about this PR?
Ideally I think features should be declared in an initializer, not in a model class, as per https://github.com/pda/flip/issues/1#issuecomment-2809201, and then the model class should be customizable. However that would be a breaking change.
Perhaps this PR is a decent backwards-compatible way to at least escape the hard-coded Feature
class though…?