Rails console tricks

Posted on January 15, 2025 by Riccardo
hash = { a: 1, b: "string", c: [1, 2, 3] }

y hash

---
:a: 1
:b: string
:c:
- 1
- 2
- 3
class User
  def initialize
    @ivar = 1
  end
  def imet
  end
  def self.cmet
  end
end

# ---

ls User

User.methods: cmet
#<Class:Object>#methods: yaml_tag
User#methods: imet

# ---

ls User.new

User#methods: imet
instance variables: @ivar
app.root_path
# or any other routes

PinkLetter

It's one of the selected few I follow every week – Mateusz

Tired of RELEARNING webdev stuff?

  • A 100+ page book with the best links I curated over the years
  • An email once a week full of timeless software wisdom
  • Your recommended weekly dose of pink
  • Try before you buy? Check the archives.