The aim of this project is practicing what we have learned about Active Record, Migrations, Associations and Validations. We have created the back-end of a blog in which you can:
- Create an author's username, email and password;
- Create author's posts which have a body and a title;
- Add comments to the posts created, witch body and title.
- Ruby on Rails version 6.0
- Browser (Google Chrome, Mozilla Firefox, Safari or any other browser)
- Ruby and Ruby on Rails installed in your machine
- SQLite installed in your machine
For the model to work properly, the associations needed to be applied as follows:
Open Terminal
run git clone [email protected]:abouhid/Micro_reddit.git
run cd Micro-reddit
run rake db:migrate
run rails c
- In the console you are able to create the authors,posts and comments, alongisde with its features, as follows on the example:
author1 = Author.create(username:'test_name', email: '[email protected]', password: 'example')
post1 = author1.posts.new
post1.title = 'Example title'
post1.body = '50 characters are necessary for this body to be accepted by the validations applied to this post model'
post1.save
comment1 = post1.comments.new
comment1.comment_title = 'test comment title'
comment1.comment_body = 'test comment body'
comment1.save
- You can check the records created by typing
Author.all
Post.all
Comment.all
๐ค Alexandre Bouhid
- Github: @abouhid
- LinkedIn: Alexandre Bouhid
๐ค Kelyn Paul Njeri
- Github: @KelynPNjeri
- Twitter: @KelynNjeri
- Linkedin: Kelyn Paul
Contributions, issues and feature requests are welcome!
Feel free to check the issues page.
Give a โญ๏ธ if you like this project!
- Microverse
- GitHub
- TheOdinProject
- Ruby
This project is MIT licensed.