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

Get filters by name #103

Closed
tfausak opened this issue Jan 15, 2014 · 4 comments
Closed

Get filters by name #103

tfausak opened this issue Jan 15, 2014 · 4 comments
Assignees
Milestone

Comments

@tfausak
Copy link
Collaborator

tfausak commented Jan 15, 2014

Currently, it's annoying to get filters by name:

class Interaction < ActiveInteraction::Base
  boolean :who_cares, :the_one_i_want
end
filter = Interaction.filters.find do |f| 
  f.name == :the_one_i_want 
end

I think it would be better if you could treat .filters as a hash:

filter = Interaction.filters[:the_one_i_want]
@AaronLasseigne
Copy link
Owner

Makes sense to me.

@tfausak
Copy link
Collaborator Author

tfausak commented Jan 15, 2014

As a result of this, I think we should remove the Filters class and replace it with a hash that maps names (as symbols) to Filters. For instance:

{
  :who_cares => #<ActiveInteraction::BooleanFilter 0x...>,
  ...
}

@AaronLasseigne
Copy link
Owner

Agreed.

@tfausak
Copy link
Collaborator Author

tfausak commented Jan 16, 2014

#108 might prevent us from replacing the Filters object with a hash.

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