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

Predicate method for boolean #89

Closed
StanisLove opened this issue Feb 11, 2021 · 2 comments
Closed

Predicate method for boolean #89

StanisLove opened this issue Feb 11, 2021 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@StanisLove
Copy link

Hi! Why is a predicate method not defined for boolean attributes?
Are there any obstacles here?

class Settings
  include StoreModel::Model

  attribute :something_enabled, :boolean, default: false
end

record.settings.something_enabled? #=> undefined method ((
@DmitryTsepelev
Copy link
Owner

DmitryTsepelev commented Feb 11, 2021

I guess you want to mimic the default Rails behavior when each bool field has a corresponding ...? method. We use Attribute API to define attributes, and for some reason it does not define that method. So there are two obstacles: it does not work out of the box and no one implemented it on the gem's side 🙂

@DmitryTsepelev DmitryTsepelev added enhancement New feature or request good first issue Good for newcomers labels Mar 28, 2021
@DmitryTsepelev
Copy link
Owner

Cloesd via #97

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants