A mini reddit clone to run on terminal.
This project consists of using Ruby On Rails to build a mini blog post system, based on command line. The application allows users to create posts and make comments.
- The model has Authors, Posts and comments
- The tables has the correct relationships
- The inputs are checked for basic validations
- Ruby 2.7
- Ruby on Rails 5.2
- Rubocop (Linter) with Stickler (CI Tool)
- Git, Github and VScode
To use this program, you will need install:
-
Ruby Language - Version 2.5 up to 2.7 - Install guide
-
Ruby on Rails - Version 5.2 - Install guide
Now you need a copy of this application, if you are using Git:
git clone git@github.com:SevlaMare/reddit.git
Otherwise just hit (Download Zip) on green button (Clone or Download) at top of this page.
Go to project folder and run on terminal:
rails console
We can create an author
x = Author.create(username: "userA", email: "abc@email.com", password: "password123")
Make a post
x.posts.create(title: "new post", body: "this is a post")
Make a comment
Post.first.comments.create(body: "some text", user_id: 1)
retrieve a user
user1 = Author.find(1)
check his first comment
c1 = user1.comments.first
see comments that belongs to this author
c1.author
can do the same for posts:
p1 = Post.first
p1.comments.first
c1.post
to leave
exit
Contributions, issues and feature requests are welcome!
You can do it on issues page.
A special thanks for the code reviewers.
👤 Rafael Nazario
- Github: @rsnazario
- Twitter: @rsnazario
- Linkedin: Rafael Nazario
👤 Thiago Miranda
- Github: @SevlaMare
- Twitter: #SevlaMare)
- Linkedin: SevlaMare)
Creative Commons