It is impossible to say this for an ActiveRecord instance
class Topic < ActiveRecord::Base
alias_method :body, :content
end
because the content accessor has not been created yet. You can force the attributes readers to be created like this:
class Topic < ActiveRecord::Base
define_read_methods
alias_method :body, :content
end
The only problem is that define_read_methods is defined as an instance method, not a class method. The current implementation begs to be a class method: define_read_methods and four other methods that it calls make repetitive calls to self.class.
This patch moves define_read_methods, plus several other methods, from instance to class methods. The patch includes a test and continues to pass all existing tests.