News for hackers. Stuff that matters.
Re:Friendly Attributes Pattern in Ruby by ryandv on Saturday November 08, 2025 @09:23PM (#45862341)
No, he is in fact correct. Rails used to be full of code such as the following, though I now see that they actually annotate code generated at Rails startup runtime with the file and the line of at least the call to the code generator [0].

There is even a fucking issue on the ruby-lang issue tracker from two years ago griping about this dark corner of the language [1].

No matter though, I don't expect average laymen to delve into this level of detail nor assess the veracity of statements at this layer.

Most Rubyists at this point are at the level of "terminal dumbfuck," and are indistinguishable from a bartender who stumbled into a 16 week bootcamp for blockchain development. The one silver lining of the great AI Happening is that these people will be put back into their place.

    irb(main):001\* class Foo
    irb(main):002"   class_eval <<-RB
    irb(main):003"     def foobar()
    irb(main):004"       puts "foobar"
    irb(main):005"     end
    irb(main):006\*   RB
    irb(main):007> end
    => :foobar
    irb(main):008> Foo.new
    => #<Foo:0x00007ff5c1a8c190>
    irb(main):009> Foo.new.method(:foobar)
    => #<Method: Foo#foobar() (eval at (irb):2):1>
    irb(main):010> Foo.new.method(:foobar).source_location
    => ["(eval at (irb):2)", 1]
[0] https://github.com/rails/rails/blob/9b054c66d4fc5ec526cff356...

[1] https://bugs.ruby-lang.org/issues/19755

There are no comments on this comment yet.