What Are Rails Parameters & How to Use Them Correctly

Let’s talk about Rails parameters! Why are they useful? Users can send data to your web application in three different ways. These three ways are: Using a query parameter (“example.com/?q=bacon”) Submitting a form (“/users/sign_in”) Within the URL itself (“/books/1”) How do you access this data from Rails? With params. Inside your controller action’s you can … Read more

How to Create Temporary Files in Ruby

Creating a temporary file gives you an empty file with a random name inside your O.S. (Operating System) temporary folder. This file gets deleted automatically. How can you do this in Ruby? Like this: require ‘tempfile’ Tempfile.create { |f| f << “abc\n” } Where f is your file & << writes to it. This is … Read more