[]
- 1.0.0 (0)
- 1.1.6 (0)
- 1.2.6 (0)
- 2.0.3 (0)
- 2.1.0 (0)
- 2.2.1 (0)
- 2.3.8 (0)
- 3.0.0 (0)
- 3.0.9 (-1)
- 3.1.0
- 3.2.1
- 3.2.8
- 3.2.13
- 4.0.2
- 4.1.8
- 4.2.1
- 4.2.7
- 4.2.9
- 5.0.0.1
- 5.1.7
- 5.2.3
- 6.0.0
- 6.1.3.1
- 6.1.7.7
- 7.0.0
- 7.1.3.2
- 7.1.3.4
- What's this?
[](attr_name)
public
Returns the value of the attribute identified by attr_name after it has been typecast (for example, “2004-12-12” in a data column is cast to a date object, like Date.new(2004, 12, 12)). (Alias for the protected read_attribute method).
read_attribute?
The source if this method and other methods indicate the reading of read_attribute (protected)
there is no documentation about the insides of this method, the only entry listed is read_attribute (private) which is deprecated since 1.2.6?
Missing method definitions
THAiSi, and any others wondering this as well:
I’ve done some pretty extensive digging in to the rails code, for a couple of projects, and I’ve found that there are several methods that don’t appear in APIDock. There are several reasons for this, but I’m not sure read_attribute falls under any of them. Perhaps it has something to do with read_attribute being defined and/or redefined in the foundation for rails (they actually do some stuff to mask out a ton of default behavior of ruby for these classes, and add their own level of inheritance functionality. Things like cattr_accessor - which is like attr_accessor, but for a class, rather than an object…
class Object < ActiveRecord::Base cattr_accessor some_attr end
would allow for reading and writing a value on the class, itself. i.e.
Object.some_attr = 5
In addition, several methods, regarding validations, callbacks, etc. are actually defined dynamically, based on things like the model name, using class_eval. These are not grabbed *at all* by APIdock, and this is where I spent most of my effort in reverse engineering how rails behaves.
Hope that helps.
read_attribute/write_attribute
I went back and looked at my notes from my previous project.
Yep, these methods were removed from ActiveRecord::Base in an early version, and moved into a Module called AttributeMethods, which is then included in ActiveRecord::Base.
So the methods are available in ActiveRecord::Base… but they are defined elsewhere.
APIdock could benefit from some better linkage, and possibly a better parser to get some of the more dynamically defined methods.