# 1. Add the 'faker' gem to your Gemfile and install it
# Gemfile
gem 'faker'
# Terminal
bundle install
# 2. In your Rails model, require 'faker' and use it to generate a fake URL
# app/models/your_model.rb
require 'faker'
class YourModel < ApplicationRecord
# Your other model code here
# Use Faker to generate a fake URL
def generate_fake_url
Faker::Internet.url
end
end
# 3. In your Rails console, create an instance of your model and call the method
# Terminal
rails console
# Inside the console
your_model_instance = YourModel.new
your_model_instance.generate_fake_url