mardi 14 mars 2017

Override gem method in rails

I want to let users add interests -TV shows in this case-, and to make sure they type a correct tv show, I'm going to search imdb first and let them select one of the returning titles.

I found this gem http://ift.tt/2eeGrRY which is doing almost what I need. If I search for "The vampire diaries", it will return it and 200 extra matches.

I went through the gem and I found that he does the querying part here http://ift.tt/2n7yu7p.

   def self.query(query)
      open("http://ift.tt/2nC3c51")
   end

That query basically uses this link http://ift.tt/2n7oQ4D and returns everything that can find given the input - movies, tv shows, episodes. Now I found a more advanced query which uses type and some other params. So I could actually return only 4 results in that case instead of 250. All I have to do is to replace that query with http://ift.tt/2nC8U7d.

How do I override that search method?

Aucun commentaire:

Enregistrer un commentaire