Skip to content

Comment on Rails ActiveRecord gotcha for newbies

Comments

No that's completely wrong. ActiveRecord will initialize getter/setter methods for all fields in your db table, and when you use those methods ruby knows they aren't local variables. So all three of the code snippets will produce the same output (although they're not equivalent)

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.