The Ruby Object Model by Dave Thomas

Szymon Madeja · 21K views · 2014 · 1:03:32

Open on YouTube

Python, Ruby & scripting languagesProgramming language designtalk

Why Stack Overflow recommends it

Stack Overflow users link it whenever someone is confused about Ruby's object model, such as class versus instance methods, singleton classes, or how `self` behaves.

Recommended by 4 people across 4 different months, 2014 to 2023.

What it is

A roughly hour-long conference talk by Dave Thomas, recorded at Scotland on Rails in 2009, explaining Ruby's object model. It covers how classes are objects, how Class and Object relate, singleton classes, and how `self` changes through method calls and class definitions.

What people said

Strong rec Andrey Deineko · 2015-10 · Stack Overflow · on “Is `validates` a class method or an instance method in Rails?”

This is a class instance method [LINK] :) As Sergio points in the comments, since every class in Ruby is an object (instance of class Class [LINK] ), validates is a method of Class 's instance. Your User class inherits bunch of stuff from ActiveRecord::Base [LINK] . Among this inherited stuff there is Validations [LINK] module. Sidenote: Watch this coolest video [this video] about Ruby object model by Dave Thomas [LINK] - things will become much-much more clear!

Strong rec radarbob · 2023-01 · Stack Overflow · on “Visual representation of Ruby Object Model”

is there a better way to illustrate it (or any other part of the model) Here is an excellent presentation on the Ruby Object Model [this video] . The presentation's money quote: Everything in Ruby is an object. Object is a class; Class itself is an object. That quote [this video] is accompanied by a text-based diagram right out of ruby source code. It is a visual klein bottle [LINK] of confusion. WATCH THE WHOLE VIDEO. At the end you'll feel like Neo [LINK] - "I know Ruby Object Model!" Dave Thomas, the speaker, is an original signer of the Manifesto for Agile Software Development [LINK] . Look up his presentation on "the death of agile". Very interesting.

Recommends Sam · 2014-07 · Stack Overflow · on “ruby: class instance variables vs instance variables”

you can call it class method but technically it is not. It's a method for the singleton class watch this [this video]

Recommends Cary Swoveland · 2015-06 · Stack Overflow · on “how can Object class in ruby be an instance of it's subclass, class "Class"”

You are speaking of Ruby's "object model". It's difficult to explain in a few words. It took the imminent Dave Thomas over an hour to explain it in this widely-watched video [this video] . So, makes some popcorn, put up your feet and enjoy.

Cites GuruM · 2014-03 · Stack Overflow · on “Good documentation for writing Redmine plugins”

I know this maybe too-late for the original question poster but might help someone else in a similar situation. Below links are for a total newbie (like me) to RubyOnRails but someone who's programmed before. You can pick and choose the relevant ones as per your skill level. Understanding Redmine (functionality): If you're not familiar with Redmine or administering other Issue Tracking Software Mastering Redmine [LINK] book is an ok place to start. It's not very densely packed so it'll help only as a structured organization of information. If you want more dense information go through the documentation instead. Understanding Redmine Plugins: "Redmine Plugin Extension and Development" by Alex

Cites Sudeep · 2015-03 · Stack Overflow · on “Instance variable access in Ruby”

self variable(current object) inside class definition is class object itself not the receiver object. self is receiver(obj), only inside method definition. [this video] at 48 minute... class Test attr_accessor :state puts self.inspect @state = 4 def check_state puts "state is #{@state}" puts self.inspect end end obj = Test.new obj.state=4 obj.check_state

Cites Cary Swoveland · 2015-08 · Stack Overflow · on “Why can't self be replaced in Ruby?”

As with most (all?) OO languages, you cannot change `self` directly. The only things that change `self` are method calls and module (including class) definitions (source: Dave Thomas [this video] ).