Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If/Unless modifiers #14

Open
palkan opened this issue Jan 26, 2018 · 3 comments
Open

If/Unless modifiers #14

palkan opened this issue Jan 26, 2018 · 3 comments

Comments

@palkan
Copy link
Collaborator

palkan commented Jan 26, 2018

class StageCloner < Clowne::Cloner
  # Symbol support (method is called on the source)
  include_association :comments, if: :published?

  # Block support
  include_association :votes, if: ->(source, record, params) { params[:need_votes] }
end
@ssnickolay
Copy link
Collaborator

Is this modifier will be for all declarations (finalize, nullify, exclude_association...)?

@palkan
Copy link
Collaborator Author

palkan commented Jan 26, 2018

Yep, I think it should be a part of abstract Base declaration (which we don't have now).

Frankly speaking, I'm not sure about the usefulness of this feature. Haven't had a case for it yet.

@ssnickolay
Copy link
Collaborator

Frankly speaking, I'm not sure about the usefulness of this feature. Haven't had a case for it yet.

But we can add flexibility in the configuration with this enhancement) And more complexity, of course...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants