pbohea

pbohea @pbohea

Joined:
Mar 26, 2025

pbohea
articles - 7 total

Pundit Authorization

def show authorize @photo end When you pass the authorize method an instance of Photo: It...

Learn More 0 0Apr 11

Enum

class FollowRequest < ApplicationRecord belongs_to :recipient, class_name: "User" belongs_to...

Learn More 0 0Apr 4

belongs_to default

In standard Rails applications, the default is opposite: belongs_to adds an automatic validation to...

Learn More 0 0Apr 3

Add Index

adding index to non-foreign key columns enables faster lookups. i.e. if you add index to the email...

Learn More 0 0Apr 3

g scaffold vs g model

The question you have to answer now is: for each of these tables, do you want to generate a scaffold...

Learn More 0 0Apr 3

find_by() & find()

find_by() returns a single instance, not an array. Movie.find_by(id:3).title will return the title...

Learn More 2 0Apr 1

Test Post Day 1

Test

Learn More 0 0Mar 26