Back to TILs

Today I Learned

Rails delegate method for cleaner code

Instead of creating pass-through methods, use delegate: ```ruby class Post < ApplicationRecord belongs_to :user # Instead of: # def username # user.name # end # Use: delegate :name, to: :user, prefix: true # Now you can call post.user_name end ```

Learned something new? Share it with others!