How to create read-only virtual attributes in Ruby models

Posted by Bill Brasky on Stack Overflow See other posts from Stack Overflow or by Bill Brasky
Published on 2010-05-04T19:13:35Z Indexed on 2010/05/04 19:18 UTC
Read the original article Hit count: 299

I would like to create a virtual attribute that will always be included when you do model_instance.inspect. I understand that attr_reader will give me the same thing as just defining an instance method, but I would like this attribute to be part of the object's "make up"

How can I accomplish this?

Thanks!

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby