Dynamic Class Methods in Ruby

Rails has a whole slew of class methods that really should be instance methods. The most notable of these methods is ActiveModel::Naming‘s model_name, which is a class method that is expected on every ActiveModel object (for example, it is expected by form_for). This code uses that as an example, but the pattern applies anywhere. If […]