- 📖 About the Project
- 💻 Getting Started
- 👥 Authors
- 🔭 Future Features
- 🤝 Contributing
- ⭐️ Show your support
- 🙏 Acknowledgements
- ❓ FAQ
- 📝 License
MindPrep Blog is a classic example of a blog website, created as a fully functional website that shows the list of posts and empowers readers to interact with them by adding comments and liking posts.
Client
Server
Database
- Fully functional website
- Leverages RDMS (PostgreSQL)
- Mini Design
- Input SQL queries with ActiveRecord
- Implement preprocessed HTML file with embedded Ruby code.
- Use layouts and templates for shared content.
- Write unit tests for models.
- Secure app from n+1 problems.
- Use validations for models.
This section will be updated as soon as it is ready.
In order to run this project you need:
- IDE or code editor: VsCode, atom, sublime...
- To have Ruby, RoR gem and Git installed on your system.
- The postgres installation doesn't setup a user for you, so you'll need to follow these steps to create a user with permission to create databases
$ sudo -u postgres createuser mindprep -s
Clone this project on your local machine using the following command on your terminal:
git clone https://github.com/abayomiolaoye/MindPrep_blog.git
cd MindPrep_blog
$ bundle init
$ bundle install
- Run linter
$ rubocop .
- In auto-correct mode, RuboCop will try to automatically fix offenses:
$ rubocop -A
# or
$ rubocop --auto-correct-all
$ rails db:create # or
$ rake db:create
$ rails s # or
$ rails server
- We need a Controller. Since everything goes through that, let's go ahead and generate one:
$ rails generate rspec:install
- This should give us a Controller and a View
- You can now visit
http://localhost:3000
to view your new website! You can also execute therails routes
command in your terminal to produce the same output.
- At the first you need to include those lines in your Gemfile
gem 'rails-controller-testing'
gem 'rspec-rails'
$ rails generate rspec:install
- This should generate some files that you will need to run your tests
- Then run:
$ rspec spec # to test if your tests are passed
$ rails generate migration CreateUsers
$ rails generate migration CreatePosts
$ rails generate migration CreateLikes
$ rails generate migration CreateComments
$ rails generate migration AddUserRefToComments
$ rails generate migration AddPostRefToComments
$ rails generate migration AddUserRefToLikes
$ rails generate migration AddPostRefToLikes
$ rails generate migration AddUserRefToPosts
$ rails generate model User name photo bio:text posts_counter:integer
$ rails generate model Post title text:text comments_counter:integer likes_counter:integer author:references
$ rails generate model Like author:references post:references
$ rails generate model Comments text:text author:references post:references
$ rails generate model User name photo bio:text posts_counter:integer
$ rails generate model Post title text:text comments_counter:integer likes_counter:integer author:references
$ rails generate model Like author:references post:references
$ rails generate model Comments text:text author:references post:references
- To push the Migration into the database
$ rails db:migrate
- We use the seeds.rb file to records in the database
- To drop, create a table and to migrate and send the seed into the database:
$ rails db:drop db:create db:migrate db:seed
- To check available routes
$ rails routes
👤 Oluwatoyin Olaoye
- GitHub: @Olaoye
- Twitter: @Olaoye
- LinkedIn: Oluwatoyin Olaoye
👤 Sammuel LEKPOR
- GitHub: @Samuellekpor
- Twitter: @samuel_lekpor
- LinkedIn: sammuel-lekpor
- Use React for the Views
- Implement some mmotions and transitions
Contributions, issues, and feature requests are welcome!
Feel free to check the issues page.
If you like this project, a star will be appreciated.
I would like to thank Paul Mosanya for his unquantifiable contributions
This project is MIT licensed.