Ruby on Rails

Sdílet
Vložit
  • čas přidán 8. 05. 2024
  • "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

Komentáře • 11

  • @Elgnonvis
    @Elgnonvis Před 6 měsíci +2

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

  • @m7marius7
    @m7marius7 Před 5 měsíci

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

  • @ledockol
    @ledockol Před 6 měsíci +1

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

  • @njongefred
    @njongefred Před 6 měsíci +2

    Thank you.

  • @GoatNews
    @GoatNews Před 6 měsíci +3

    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  Před 6 měsíci +2

      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 Před 5 měsíci +1

      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
    @haroldpepete Před 5 měsíci

    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
    @ritualmoon9319 Před 6 měsíci

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

  • @ritualmoon9319
    @ritualmoon9319 Před 5 měsíci +2

    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