我有以下课程:
class Message
extend ActiveModel::Naming
include ActiveModel::Conversion
attr_accessor :name, :emails, :custom_content
def initialize(attrs = {})
attrs.each do |k, v|
self.send "#{k}=", v
end
end
def persisted?
false
end
def email_list
self.emails.split(",").collect { |email| {:email => email.delete(" ")} }
end
end
当我在代码中调用属性时,我总是想将 name 属性大写,而不是总是这样做。