Ruby on Rails coding help: Exclusive (AND) search on association
$100-150 USD
Đã hoàn thành
Đã đăng vào gần 12 năm trước
$100-150 USD
Thanh toán khi bàn giao
I am building a Rails app for a client that stores Casinos, Games at the Casinos, Jackpots, etc.
To simplify things here, here's a brief structure of the relevant pieces:
Models:
[login to view URL]
has_many :jackpots
has_many :jackpot_games, :through => :jackpots
[login to view URL]
belongs_to :jackpot_game
belongs_to :casino
[login to view URL]
belongs_to :jackpot_type
has_many :jackpots
I have a big search page with a check-box for each game. I have been struggling to build an exclusive (AND) search that will provide results for casinos that have ALL of the games selected in the search. I have been able to successfully build an inclusive (OR) search where it will show casinos that have ANY of the selected games, but that is not what the client needs.
I have been using the libraries [Meta_Where][1] and [Ransack][2] by Ernie Miller, but without success. Whenever I make the field name "q[games_id_in_all][]" - but this return 0 results if more than one game is selected. I am open to using any Rails-standard implementation or any other open-source implementation necessary.
Deliverables: Working exclusive (AND) search functionality for the search described above. The work will be performed on my own development server on a limited user account. You will have SSH access, and you will be able to access the development web server (Passenger) on port 3000.
Please let me know if there are any additional questions.
## Deliverables
See attached file for sample of existing code.