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

Removing flags #86

Open
renra opened this issue Mar 17, 2020 · 0 comments
Open

Removing flags #86

renra opened this issue Mar 17, 2020 · 0 comments

Comments

@renra
Copy link

renra commented Mar 17, 2020

Removing existing flags leads to an issue with the class methods. Here is a minimal example ...

Initial state ..

class Spaceship < ActiveRecord::Base
  include FlagShihTzu

  has_flags 
            1 => :warpdrive,
            2 => :shields
end

s = Spaceship.create!
s.warpdrive = true
s.shields = true
s.save
s.flags # => 3

Spaceship.warpdrive.count # => 1, all is well

Now we change the flags to just ..

class Spaceship < ActiveRecord::Base
  include FlagShihTzu

  has_flags 
            1 => :warpdrive
end

s = Spaceship.first
s.flags # => 3
s.warpdrive? # => true

# Here is the problem
Spaceship.warpdrive.count # => 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant