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

Question how can I filter on advertisement type ? #2

Closed
essaiplatform opened this issue Mar 27, 2014 · 1 comment
Closed

Question how can I filter on advertisement type ? #2

essaiplatform opened this issue Mar 27, 2014 · 1 comment

Comments

@essaiplatform
Copy link

Hi,

I am a first year student and a beginner in ruby.

I'd like to know what's the best way to make filters on the advertisement types ? like some tag or button (one per type) we could click ?

Thanks

@azhi
Copy link
Owner

azhi commented Mar 28, 2014

Hi.

If you want just to filter by ads type, possible solution would be passing type_id param on index action and applying something like where(type_id: params[:q][:type_id]) if params[:q][:type_id].present? to scope.

Then you can make buttons and/or form with input, which will send [:q][:type_id] param.

If you want more flexible search, something like ransack can be used (https://github.com/activerecord-hackery/ransack)

@azhi azhi closed this as completed Jun 27, 2014
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

2 participants