Giter Site home page Giter Site logo

odhiambo-ed / blog-app Goto Github PK

View Code? Open in Web Editor NEW

This project forked from evans22j/blog-app

0.0 0.0 0.0 192 KB

The Blog app will be a classic example of a blog website. You will create a fully functional website that will show the list of posts and empower readers to interact with them by adding comments and liking posts.

License: MIT License

JavaScript 0.09% Ruby 73.40% CSS 5.49% HTML 16.76% Batchfile 4.26%

blog-app's Introduction

Blog-app

Description

The Blog app will be a classic example of a blog website. You will create a fully functional website that will show the list of posts and empower readers to interact with them by adding comments and liking posts.

Learning objectives

  • Diagram a data model clearly and explain what it's doing.
  • Understand how to use medium-fidelity wireframes to create a UI.
  • Use controllers to handle requests and render empty views.
  • Install Ruby on Rails framework.
  • Use Ruby Gems as a software packages system.
  • Understand Rails naming conventions.
  • Use params from browser requests in a safe way.
  • Write tests for controllers.
  • Understand what ORM is.
  • Use database migration fails to maintain database schema.

Getting Started

To get a local copy for this project and running follow these simple example steps.

Prerequisites

  • You need to have git installed in your machine.
  • Install a recent version of Postgres.
  • Already install Rails

Setup

Setting Up PostgreSQL

  • 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 blog-app -s

Clone this repository

$ git clone https://github.com/BenMukebo/Blog-app.git
$ cd Blog-app

Creating the hello-rails Application

  • use PostgreSQL database
$   rails new hello-rails --database=postgresql  #or
$   rails new hello-rails -d postgresql

$   cd hello-rails # Move into the application directory

Install linter

$  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

Create the database

$   rails db:create   # or
$   rake db:create

Starting up the Web Server

$   rails s # or
$   rails server 

Generate Controller

  • 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

Listing Existing Routes

  • You can now visit http://localhost:3000 to view your new website!

You can also execute the rails routes command in your terminal to produce the same output.

Generate rspec

  • At the first you need to include those lines in your Gemfile
  gem 'rails-controller-testing'
  gem 'rspec-rails'
  • Then run:
$  rails generate rspec:install
  • This should generate some files that you will need to run your tests

Generate migration files

  $  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

Generate Model

  $  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

Generate Schema

To push the Migration into the database

  $   rails db:migrate

Built With

This project is build with:

  • Ruby
  • Ruby on Rails

Authors

๐Ÿ‘ค Evans Sitibekiso

๐Ÿค Contributor

Contributions, issues, and feature requests are welcome!

Feel free to check the issues page.

Show your support

Give a โญ๏ธ if you like this project!

Acknowledgments

  • Thanks to microverse for this project
  • Inspiration
  • etc

๐Ÿ“ License

This project is MIT licensed.

blog-app's People

Contributors

evans22j avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.