Ruby is a Object Oriented Language (OOP) which means that everything created is an object or an object of something. Ruby has this amazing functionality that makes a programmers every day life a lot easier to deal with and one of these functionalities are gems. Gems are different types of built in libraries in Ruby. Gems can be used to extend or modify functionality in Ruby applications. By simply creating a Gemfile you are able to call insert and call upon these libraries. You simply need to go to your terminal and type in the following commands I have mentioned for each gem to be installed in the descriptions below.
This gem can be installed on your computer by running gem install pry. Once installed you can insert it into your Gemfile inside your code editor by writing gem "pry" and by inserting require 'pry' on top of the file you are working in. This gem creates a debugging functionality, and an IRB alternative. It is very user friendly and definitely makes your debugging/testing process much easier.
This gem can be installed by running gem install tty-prompt in your terminal. I just recently stumbled upon this gem in ruby during my third week of attending Flatiron coding bootcamp. This is a amazing gem that allows user interface within your console. This is great for CLI (command-line interface) applications which are run through your terminal or shell. They have no graphics or visual interface beyond what you see in your terminal after you run the program.
This gem can be installed by running gem install sqlite3 in your terminal. Active Record is a great way of storing data into a database, but it can not be done alone. For instance I am using Ruby along with sqlite3 in order to produce, and call different methods that allow me to create instances and store them in a database. Although sql does not store information in a database, it is used to create tables of data that store information. This is especially useful when working with active record in that it stores everything in your data base according to it's associations with other objects in your table.
This gem can be installed by running gem install faker in your terminal. The faker gem automatically creates data for you that you can enter into a database. Some examples of fake information that can be generated are names, addresses, email addresses, etc. You can set up a method. In order for this to work you met set up a seed data file within your migrations folder. Then you can simply run db:seed and depending on the number of instances you wanted to add then that number of instances will be generated.
This is a great way to set up your seed file with alot of data that you can manipulate later but saves alot of time. But don't forget to set your migration tables first!
Don't get this mistaken with "require". Require is used in individual files to require a certain gem. Without this require_all gem we would need to specify each file that is associated to one another. Instead of going back to each file and writing out the full file path which can be a pain, with this gem you simply put the name of the directory, and all files associated to that directory will be loaded.
This gem allows resetting the id of AR table to 0. This gem is a add on to ActiveRecord, when you create new instances in your database they are set with an id that starts at 1, and each instance you create updates the id number in an ordered sequence. Now if you decide to delete one or more elements in the table without this gem the id sequence would continue to increment by 1 at a time. But before you start making new instances again you must call the name of your model.reset_pk_sequence. So if you had a model called Car, then you would call Car.reset_pk_sequence, and from then on your id's are set back to the starting point of 1.