Rails Tutorial | How to build a blog with Rails 5 and Bootstrap 4 - Part 3

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ม.ค. 2025

ความคิดเห็น • 14

  • @doubleastudiogames
    @doubleastudiogames 8 ปีที่แล้ว +5

    Nice video, yet again! For anyone interested in Bootstrap 4 styling instead of the tag you can use to achieve the same result.

    • @TechmakerTV
      @TechmakerTV  8 ปีที่แล้ว +1

      Thanks for the tip!

  • @ScottAgirs
    @ScottAgirs 7 ปีที่แล้ว +1

    Great series so far.
    One quick remark - I don't know nor understand why this happening, but for me the "New Post" didn't work. The submit action form_for(post) kept sending the POST request to "/posts" instead of "/author/posts".
    After some reading I changed "form_for(post)" to "form_for [:author, @post]" (in views/author/posts/_form.html.erb) and now it works. And of course according changes to the rest of the files.

  • @stephenw4720
    @stephenw4720 8 ปีที่แล้ว +1

    Hey Techmaker, I really like your training materials. we are copying the "post" folder into "author" from "blog" I wonder if there is a way we could put "posts" folder under a "shared" folder so that both author and blog could access it (DRY UP methodology). The folder tree looks like:
    views
    |
    author
    |
    blog
    |
    shared
    |
    posts

    • @TechmakerTV
      @TechmakerTV  8 ปีที่แล้ว +1

      You could certainly do that if you think it's a good idea. I tend to tolerate a certain amount of duplication until I'm certain that the code is really talking about the same thing. For instance, in a thoroughly built out application, those views for author vs. blog might actually differ quite a lot from one another.
      Check out this article by Sandi Metz for more thoughts: www.sandimetz.com/blog/2016/1/20/the-wrong-abstraction

  • @stevenossorio8524
    @stevenossorio8524 7 ปีที่แล้ว

    Great videos so far. Learning a lot but I got a question on this video. I'm trying to wrap my head around customizing the controllers (from application). If we were to have a user for example, that information would be in the author directory as user_controller.rb? Can you explain why it was done this way. I get it's conventional but I'm still confused to what purpose. Sorry in advance and also thank you for this video and hopefully explaining to me.

    • @TechmakerTV
      @TechmakerTV  7 ปีที่แล้ว

      Throughout this course, I actually decided to break a few standard Rails conventions. In a pure Rails convention style, you would just have a User model (app/models/user.rb), a UsersController (app/controllers/users_controller.rb), and a /users view directory, (app/views/users/...).
      I decided to change it up a bit to suit my preferences. It's really just an organization decision. You can do it various ways with various pros and cons.
      I'm not sure if that answers your question or not. Best - Stephen

  • @dmytrokharytonenko5016
    @dmytrokharytonenko5016 7 ปีที่แล้ว

    Thanks a lot.

  • @evanyates965
    @evanyates965 7 ปีที่แล้ว

    I'm loving your videos! Unfortunately, I'm having an issue with the 'New post' button in author/posts/index.html.erb. From what I can tell I have the same file as in the video, but the button isn't appearing on the page. I've already tried changing bootstrap v4alpha6 to bootstrap v4alpha3, which fixed some issues with the navbar, but not the 'New post' button. Any ideas?

    • @TechmakerTV
      @TechmakerTV  7 ปีที่แล้ว

      Hi Evan. Can you post a little bit of code? Otherwise you might clone the repository and see if works better (github.com/StephenFiser/FrogBlog)

  • @jj-dc6fu
    @jj-dc6fu 6 ปีที่แล้ว

    how did you get the navbar to display horizontally? both my navbars are still vertical even though my css and code for the _navbar partial are copied from the repository. Could you please specify which part of the css tells the navbar to display horizontally so i can check it? thanks.

    • @AshEnte
      @AshEnte 6 ปีที่แล้ว

      You have to change from to in your _navbar.html.erb

    • @arryaz051
      @arryaz051 6 ปีที่แล้ว

      THANK YOU ! Actually i had it working without the last "bg-light" since it renders all white.