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:
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.
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…
These are 5 ways in which we can select elements in the DOM using selectors
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
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 another…End
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.
Class CitiesAttr_accessor: airpor, :police department, :schoolEnd
Defining a class in Ruby is pretty simple, simply write class keyword followed by…