Displaying Posts – DIY Twitter Clone #7.1

Today we populate our views with posts from the database. We will do some work on our bootstrap css, and learn about the where clause which lets us cut down objects into more relevant pieces.

Download this project’s files at:


“Clean Code” by Robert C. Martin:
“Game Coding Complete” by Mike McShaffry:
“JavaScript and JQuery” by Jon Ducket:


Creating, updating and managing DevFactor’s large collection of tutorials requires many hours of work on a weekly basis. If you have found our tutorials useful, please support us by subscribing and sharing our videos on social media.

If you have any feedback in regards to how we could improve the channel’s content, editing, or organization feel free to get in touch and make a suggestion!

Subscribe on YouTube:


DevFactor offers high-quality, project based tutorials on web development, game development and software engineering. Simply by subscribing you can gain access to our large library of free programming video tutorials.

DevFactor was started in order to aid anyone regardless of age, race, gender or location to learn how to build, maintain and deploy their own software applications.

#programming #code #devfactor






12 responses to “Displaying Posts – DIY Twitter Clone #7.1”

  1. Mohamed Sameh Avatar

    I got an error unable to autoload constant PagesController, expected /home/ubuntu/workspace/app/comtrollers/pages_controller.rb to define it raise LoadError, "unable to autoload constant #(qualified_name), expected #(file_path) to define it" unless from_mod_const_defined?(const_name,false)

  2. Mario Jones Avatar

    Hello I am getting an error:

    undefined method `each' for nil:NilClass
    Extracted source (around line #19):

    <div class="col-xs-6">
    <% for @p in @posts %> # line 19
    <div class="panel panel-default">
    <div class="panel-body">
    <p><%= @p.content %></p>

    I have went back 2 lessons and can't find my error. Please help Thanks

  3. Rob Thompsons Avatar

    Where is the narrowing down of posts by the followings?

  4. Tech Auriga Avatar

    Hello I am getting this error:

    undefined method `created_at' for #<Class:0x007f4e3dd97e60> Did you mean? create

    Its in the post.rb at line 5

    validates :user_id, presence: true
    validates :content, presence: true, length: { maximum: 140 } #tweets are capped at 140 chars.
    default_scope -> { order(created_at :desc) }

    For some reason it doesntk now what it means by created_at

  5. Kris Chery Avatar

    I am having a problem, my nav bar is stuck on user Logged In mode. I can't seem to get back to the /users/sign_in (/sign_up). The browser displays that i am already signed in when i try to route the Signed Up or Sign In Page. When i tried running the project on local but all i got back was the code below. HELP!!!

    Any help would be much appreciated.

    1st Browser safari (Default development browser)
    2nd Browser ( Test Development Browser) 

    Running this project on my local machine.

    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><%= current_user.username%> <span class="caret"></span></a>

  6. butterhead777 Avatar

    I refreshed 2 times and now I have the 505th view ^-^

  7. Richard Boseley Avatar

    Yes, great work – you're helping me understand Rails. Thank you!

  8. The Tentacles Avatar

    If you could make the fonts of your code bigger, this series of tutorial would be near perfection. Perhaps you could do this in the next tutorial. Good job, though!

  9. Innocent Kithinji Avatar

    you forgot the post form

  10. Innocent Kithinji Avatar

    Please help show how to use socialize gem for likes, following method and mentions

  11. WhatGege Avatar

    Please make more!

Leave a Reply

Your email address will not be published. Required fields are marked *