Validations are used to ensure that only valid data is saved into your database. For example, it may be important to your application to ensure that every user provides a valid email address and mailing address.

There are several ways to validate data before it is saved into your database, including native database constraints, client-side validations, controller-level validations, and model-level validations:

  • Database constraints and/or stored procedures make the validation mechanisms database-dependent and can make testing and maintenance more difficult. However, if your database is used by other applications, it may be a good idea to use some constraints at the…

API

The term API stands for Application programming interface. An API for a website is code that allows two software programs to communicate with each other.

API spells out the proper way for a developer to write a program requesting services from an operating system or other application.

REST

The term REST stands for Representational State Transfer. It is an architectural style that defines a set of rules in order to create Web Services. …


React allows us to pass data from one component to another component using Props which stands for properties. The data can come in different forms: numbers, strings, arrays, functions, objects, etc.

Props can only be passed from parent to child components (uni-directional flow).

There are cases however, with the use of callback functions where props can be passed from a child to a parent component. Furthermore, data received from props is read-only and cannot be modified by a child component receiving it.

How do you pass data with props?

Here is an example of how data can be passed by…


JavaScript is most commonly used to get or modify the content or value of the HTML elements on the page, as well as to apply some effects like show, hide, animations etc. But, before we can perform any action we need to find or select the target HTML element. DOM Selectors are useful in helping us find and target those elements.

These are 5 ways in which we can select elements in the DOM using selectors

  • querySelector()
  • querySelectorAll()
  • getElementsByTagName()
  • getElementsByClassName()
  • getElementById()

These selectors are method of the document object. …


The routing module provides URL rewriting in native Ruby. It’s a way to redirect incoming requests to controllers and actions. It replaces the mod_rewrite rules. Best of all, Rails’ Routing works with any web server. Routes are defined in app/config/routes.rb.

Think of creating routes as drawing a map for your requests. The map tells them where to go based on some predefined pattern.

How to define a route

in app/config/routes.rb.

Rails.application.routes.draw doPattern 1 tells some request to go to one placePattern 2 tell them to go to anotherPattern 3 tell them to go to anotherEnd

In object-oriented programming classes and objects plays an important role.

A class is a blueprint from which objects are created. The object is also called instance of a class.

For example, we can have a class called cities, in our class we can set requirements such as Airport, police department and a School, we call these attributes. If we want to create a new city/object it will have to include an Airport, Police department and a School.

https://media.giphy.com/media/3o84U8cygG2b0x34ly/giphy.gif

Here’s an example:

Class and attributes

Class CitiesAttr_accessor: airpor, :police department, :schoolEnd

Defining a class in Ruby is pretty simple, simply write class keyword followed by…

Alex Ngundji

Software Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store