This project is about an application similar to Reddit (called Micro-Reddit) where a user can create a post and add comments to it.
Contributions make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
Ruby & Rails installed on your local machine. bundle installed on your machine Terminal or similar to execute the program.
- To get a local copy up and running follow these simple example steps.
- Clone this repository with git clone
https://github.com/uwadonat/Rails_ActiveRecord.gitusing your terminal or command line. - Change to the project directory by entering:
cd ActiveRecord/Micro_Redditin the terminal.
- run the command
bundle installThis will install the required dependencies - run the command
rails db:create. This will initialize the necessary migration files - run the command
rails db:migrate - run the command
rails console
-
Validations to test:
- u2 = User.find(2)
- c1 = u2.comments.first - should return that user’s comment.
- c1.user - should return that comment’s author User (u2)
- p1 = Post.first
- p1.comments.first - should return the comment c1
- c1.post - should return the post p1
👤 Donat UWAMAHORO
This project is MIT licensed.