Setup an Admin Dashboard and Improve Searches | Ruby On Rails For Beginners Part 7

Sdílet
Vložit
  • čas přidán 8. 05. 2024
  • Using Devise, we'll create user roles for normal users and admin users by creating an enum. We'll then use this to create a dashboard where we avoid N+1 queries by using the .includes method. We also fix the Ransack gem searching issue after we move the post body from a regular text to an Action Text body. This allows us to search the Action Text body.
    Join this channel to help support these videos:
    / @deanin
    Source code: github.com/Deanout/blog_appli...
    Playlist: • Intro Ruby on Rails 7 ...
    Follow me on social media:
    linktr.ee/deanin
    Join this channel to get access to perks:
    / @deanin
    If you liked this video, please consider subscribing: t.co/RZ4EwP0F2a
    Timestamps
    0:00 Creating An Admin Dashboard In Rails 7
    1:13 Creating Devise Admin User Roles
    5:21 Making Ransack Work With Action Text In Rails 7
    10:55 Creating Admin Only Routes In Rails 7
    13:44 Creating The Admin Controllers And Fixing N+1 Queries
    15:10 Creating The Admin Dashboard Page
    27:23 Fixing Notifications When Deleting Posts In Rails 7
    28:00 Finishing The Admin Post Show Page
    #Deanin #Software #Programming

Komentáře • 13

  • @Deanin
    @Deanin  Před 2 lety +5

    Hopefully this ends up being helpful. I was trying to cover a gem for the dashboard, but they are all in such a state right now when it comes to supporting Action Text that I decided it'd be better for us to cover creating our own solution. :) We also fix a bunch of stuff, talk about N+1 queries (blowing up the database)
    If Action Text image uploads aren't working for you, go watch this: czcams.com/video/1cw6qO1EYGw/video.html

  • @dencam
    @dencam Před 2 lety +2

    Here on standby for this awesome episodes

  • @ledockol
    @ledockol Před 2 lety +2

    Excellent. Thanks

  • @ricardomordaunt1101
    @ricardomordaunt1101 Před rokem +2

    Thanks Dean...

  • @nonanik112
    @nonanik112 Před 2 lety +3

    ☺plans to get rid of my mistakes by looking at you Rail 7 I hope you use ActiveAdmin

  • @randerins
    @randerins Před 2 lety +2

    Hey Deanin, thanks for another great vid. Not sure if you already covered how to hide credentials/API keys on Rails and the best way to do it, before deploying the project. Just a video suggestion.

    • @Deanin
      @Deanin  Před 2 lety +3

      I'll add it to the list! Should be a quick but very useful tutorial, so thank you for the suggestion :)
      If you need to do this right now, I recently did a video on pushing a chat room to Heroku that used the Rails Encrypted Credentials system to hide credentials for the production server.
      Should be about 4:47 into the video. I change the DB to postgres and setup its environment variables for use in production.
      czcams.com/video/d2-cd4RKFwA/video.html

    • @randerins
      @randerins Před 2 lety +1

      @@Deanin Thanks! I'll check it out

    • @Deanin
      @Deanin  Před 2 lety +1

      @@randerins I think in the video I used VS code as the editor, if you'd prefer to use Nano or Vim, the command becomes:
      EDITOR=nano rails credentials:edit

  • @salvadoraguirre8689
    @salvadoraguirre8689 Před 2 měsíci

    In the routes.rb file, where does the authenticated method comes from? From devise? If I'm in another project and I do not use devise, how can handle that?

  • @MrMrbannanapants
    @MrMrbannanapants Před rokem +3

    Hey, I'm confused as to how we still have a link to the body even though when I open our schema there is no reference to it. If we remove the body column, how can we create a new post with a body field?

    • @Deanin
      @Deanin  Před rokem +1

      It's been a while since I've done this video so I don't entirely remember what I did, but chances are I used a "has_rich_text :body" in the model. That does a bit of magic under the hood that causes the model to still have a body column. I'm not a fan of it doing the magic personally because I think it would be much more clear if you had to define it yourself, but that's _probably_ what I did here. Sorry for the confusion.

  • @minmaunghein7236
    @minmaunghein7236 Před rokem +1

    integration Rails 7 with AdminLTE