Code Monkey home page Code Monkey logo

blog_worthy_pai's Introduction

README

This README would normally document whatever steps are necessary to get the application up and running.

Things you may want to cover:

  • Ruby version

  • System dependencies

  • Configuration

  • Database creation

  • Database initialization

  • How to run the test suite

  • Services (job queues, cache servers, search engines, etc.)

  • Deployment instructions

  • ...

blog_worthy_pai's People

Contributors

abhirampai avatar

Watchers

 avatar

blog_worthy_pai's Issues

Create Post Model

Create a Post model with the following attributes:

  • title: This field indicates the title of the idea post for a blog and should not be NULL.
  • description: This field indicates the content of the post. It should not be NULL.
  • upvotes: This integer field indicates the number of upvotes for the post. It should have a default value of zero and should not be NULL.
  • downvotes: This integer field indicates the number of downvotes for the post. It should have a default value of zero and should not be NULL.
  • is_blog_worthy: This boolean field indicates whether the idea can be transformed into a blog. It should have a default value of false.

Add validation for fields in post model

Add the following validations to the Post model:

  • Validate the presence of the title field. Also, make sure that it has a maximum length of 125 characters.
  • Add custom validation to ensure that the net vote, i.e., upvotes - downvotes, does not acquire a negative value.
  • Validate the presence of the is_blog_worthy field. If you want to validate the presence of a boolean field, you will want to use validates_inclusion_of :field_name, in: [true, false]

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.