Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ericmbouwe/micro-reddit

Micro-reddit is a project which describes associations between data structures necessary to support user's posts submissions and comments on those posts
https://github.com/ericmbouwe/micro-reddit

Last synced: about 19 hours ago
JSON representation

Micro-reddit is a project which describes associations between data structures necessary to support user's posts submissions and comments on those posts

Awesome Lists containing this project

README

        

# Micro-reddit

[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]





Microverse Logo


Micro-reddit Application




This project is part of the Microverse curriculum in Ruby On Rails course!


Explore the docs »




Report Bug
Request Feature

Micro-reddit is a project which describes associations between data structures necessary to support user's posts submissions and commenting on those posts

## Table of Contents

- [About the Project](#about-the-project)
- [Application Instructions](#application-instructions)
- [System Requierments](#system-requierments)
- [Configuration](#configuration)
- [Database initialization](#database-initialization)
- [Development](#development)
- [Built With](#built-with)
- [Contributors](#contributors)
- [Acknowledgements](#acknowledgements)

## About The Project

The project creates a SQLite database which holds the following tables:
- User
- Fields : name, created_at, update_at
- Post
- Fields : title, body, user_id, created_at, updated_at
- Comment
- Fields : text, user_id, post_id, created_at, updated_at

A User can have a number of Posts and each Post can have a number of Comments related to a User


## Application Instructions

Examples that can be applied using the rails console

### These will add a new user
```
user = User.new
user.name = 'User 01'
user.save
```
OR
```
User.create(name: 'User 02')
```

### These will add a new post assotiated to the first user
```
post = User.first.posts.new
post.title = 'Title of the first post'
post.body = 'Body of the first post'
post.save
```
OR
```
User.first.posts.create(title: 'Tile of the post', body: 'Body of the post')
```

### These will add a new comment assosiated to the first post of the first user and assosiated (the comment) to the last user
```
com = User.first.posts.first.comments.new
com.text = 'Some comments'
com.user_id = User.last.id
com.save
```
OR
```
com = User.first.posts.first.comments.create(text: 'Some comments', user_id: User.last.id)
```


## System Requierments
- Ruby
- Rails
- Yarn

## Configuration
- first, clone the project
Run
```
git clone https://github.com/ericmbouwe/Micro-reddit.git
```

- Install the necessary dependancies
Run
```
bundle install
yarn install
```


## Database initialization
In order to add initial data to the database run

```
rails db:seed
```
This will add 2 users, 2 posts and 4 comments


## Development
* Clone the project
```
https://github.com/ericmbouwe/Micro-reddit.git
```


## Built With

This project was built using these technologies.

- Ruby version 2.6
- Ruby On Rails version 6.0


## Contributors

:bust_in_silhouette: **Author_1**
​## Eric Mbouwe

- Github: [@ericmbouwe](https://github.com/ericmbouwe)
- Twitter: [@ericmbouwe](https://twitter.com/ericmbouwe)
- Linkedin: [Eric Mbouwe](https://www.linkedin.com/in/ericmbouwe/)
- E-mail: [email protected]

:bust_in_silhouette: **Author_2**
​## Ioannis Kousis

- Github: [@ioanniskousis](https://github.com/ioanniskousis)
- Twitter: [@ioanniskousis](https://twitter.com/ioanniskousis)
- Linkedin: [Ioannis Kousis](https://www.linkedin.com/in/ioannis-kousis-9a5051b4/)
- E-mail: [email protected]


## Acknowledgements

- [Microverse](https://www.microverse.org/)
- [The Odin Project](https://www.theodinproject.com/)
- [Ruby Documentation](https://www.ruby-lang.org/en/documentation/)

[contributors-shield]: https://img.shields.io/github/contributors/ericmbouwe/Micro-reddit.svg?style=flat-square
[contributors-url]: https://github.com/ericmbouwe/Micro-reddit/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/ericmbouwe/Micro-reddit.svg?style=flat-square
[forks-url]: https://github.com/ericmbouwe/Micro-reddit/network/members
[stars-shield]: https://img.shields.io/github/stars/ericmbouwe/Micro-reddit.svg?style=flat-square
[stars-url]: https://github.com/ericmbouwe/Micro-reddit/stargazers
[issues-shield]: https://img.shields.io/github/issues/ericmbouwe/Micro-reddit.svg?style=flat-square
[issues-url]: https://github.com/ericmbouwe/Micro-reddit/issues