Ruby on Rails

"Global search" allows you to search multiple attributes of multiple models in a single search form.
For example, on superails.com when you perform a search in the navbar you get results for Posts, Tags, Playlists.
We will build a scalable global search, so that you can easily add new models and attributes to search on.
This video topic was suggested by @Elgnonvis . Want me to do a video about a topic? Add your ideas in the ocmments.
Episode source code: github.com/corsego/150-global...
Based on this blogpost: blog.corsego.com/search-multi...
0:00 Global Search examples
2:02 Basic global search
11:02 Advanced global search
23:30 Final demo

Пікірлер: 11

  • @Elgnonvis
    @Elgnonvis6 ай бұрын

    Wow! Here we are! Thanks a lot 🎉🎉🎉

  • @m7marius7
    @m7marius75 ай бұрын

    Please make a video for ignoring diacritics in search. Thank you!

  • @njongefred
    @njongefred6 ай бұрын

    Thank you.

  • @ledockol
    @ledockol6 ай бұрын

    Супер. Дякую😊

  • @GoatNews
    @GoatNews6 ай бұрын

    I came here from the Ruby documentary on honeypot. How do I install ruby on a LAMP stack server? 😭😭😭 I want to learn it, it sounds easy.

  • @SupeRails

    @SupeRails

    6 ай бұрын

    Hi, nice to meet you! Rails was the first thing I learned when starting programming = definitely easy to start 😅 To install it, try visiting rails.new and running the script

  • @haroldpepete

    @haroldpepete

    6 ай бұрын

    the easy way is using wsl in windows, you have a linux environment and you just need apt get to install anything, i mean with anything, ruby, rails and nodejs, nodejs to use external css libraries like tailwind

  • @haroldpepete
    @haroldpepete6 ай бұрын

    i do my own implementation of searching, i use inject to create nested where and or, everything but start with q_ will be filtered and q_ will be filtered using or, rails use in when the condition is an array, inject is awesome, that blow my mind, rails calls inject recursively

  • @ritualmoon9319
    @ritualmoon93196 ай бұрын

    How would you include a rich text attribute in the controller index method?

  • @ritualmoon9319
    @ritualmoon93196 ай бұрын

    This rather messy approach works but is there a more succinct syntax: @posts = Post.includes(:rich_text_description).joins("INNER JOIN action_text_rich_texts ON action_text_rich_texts.record_id = posts.id").where("posts.name ILIKE ? OR action_text_rich_texts.body LIKE ?", "%#{params[:query]}%", "%#{params[:query]}%").uniq

  • @someguyO2W

    @someguyO2W

    2 ай бұрын

    It's sql. It's fine.