I have some properties that I want setable externally, but readable only
internally. I’ve played around with attr_writer (and attr_reader
separately) but can’t figure out how to get either to work. I can do
what I want using attr_accessor, or just straight out defining the prop
setter method. Anybody know how to use attr_writer or attr_reader with a
model?
I have some properties that I want setable externally, but readable only
internally. I’ve played around with attr_writer (and attr_reader
separately) but can’t figure out how to get either to work. I can do
what I want using attr_accessor, or just straight out defining the prop
setter method. Anybody know how to use attr_writer or attr_reader with a
model?
It should work out of the box. What’s not working?
I have some properties that I want setable externally, but readable only
internally. I’ve played around with attr_writer (and attr_reader
separately) but can’t figure out how to get either to work. I can do
what I want using attr_accessor, or just straight out defining the prop
setter method. Anybody know how to use attr_writer or attr_reader with a
model?
You da man,
Joe
attr_* methods create public methods for accessing instance varables.
If you dont want the reader method to be puclic, then use attr_writer
only.