Git Product home page Git Product logo

blog-app's Introduction

BLOG APP

This is a simple blog application that has been built using Ruby on Rails.

Things you may want to cover:

1 - Versions

Ruby:

ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]

Rails:

Rails 6.1.4.4

Database SQLite3:

3.31.1 2020-01-27 19:55:54

2 - How can you run this application ?

A: You can run this application in https://vicente-blogger.herokuapp.com/ website or by following instructions on the official website Ruby on Rails. After installing Ruby on Rails, clone this app, go inside to directory /blog-app and run the command into your terminal rails server then copy and paste this address to your Browser URL 127.0.0.1:3000.

3 - How is this app structured?

3.1 - What models does the application have?

A: It has an Article, Category, ArticlesCategories and Users model.
An Article can have many Categories, and it result, ArticlesCategories.
An User can have many Articles.

4 - Explain theirs associations

An Article can have many Categories, and it result, ArticlesCategories.

 class Article < ApplicationRecord

	belongs_to :user
	has_and_belongs_to_many :categories, join_table: 'articles_categories'

	validates :user_id, presence: true 
	validates :title, presence: true, length:{ minimum: 3}
	validates :description, presence:true, length: { minimum: 10, maximum:200 }
end
class Category < ApplicationRecord

	has_and_belongs_to_many :articles, join_table: 'articles_categories'

	validates :name, presence: true, uniqueness:true, length:{ minimum: 3, maximum: 30 }
end
class ArticlesCategory < ApplicationRecord
end

An User can have many Articles.

class User < ApplicationRecord

   has_many :articles

  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :validatable

end

Done by Vicente Simão

blog-app's People

Contributors

vicente-jpro avatar

Stargazers

Leonidas avatar  avatar

Watchers

 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.