Attr_readonly and if/unless

Hello,

I tried to apply attr_readonly :some, :attributes to all none root-
nodes of an acts_as_tree model. The important part here is that:
“”"
attr_readonly :some, :attributes unless some_condition
“”"
doesn’t seem to work: all objects have :some and :attributes set to
read_only, even if they meet some_condition. After searching for that
a little bit, I discovered that it had been corrected in bugmash not
that long ago (and now that I mention it, I can only find this ML-post
http://osdir.com/ml/RubyonRails:Core/2009-03/msg00022.html
…).

Anyway, does anyone know a way how to get this behaviour on 2.3.3
(other than writing custom setters, of course…)?

Thanks,

Felix

On Sep 2, 3:28 pm, Felix Schäfer [email protected] wrote:

that long ago (and now that I mention it, I can only find this ML-posthttp://osdir.com/ml/RubyonRails:Core/2009-03/msg00022.html
…).

Anyway, does anyone know a way how to get this behaviour on 2.3.3
(other than writing custom setters, of course…)?

Well you could see if the patch that was written for this applies
cleanly to 2.3.3 or can be turned into a small plugin.

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs