diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-01-05 09:58:25 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-01-05 09:58:25 -0800 |
commit | 9f1b0b32e27af668014c6fb21edbfc869f36dd2d (patch) | |
tree | c2059742f450fc90dd73a23e5b13982e43df774b | |
parent | 8bdc191994bb091310cbbe4690900e7a97da0b5e (diff) | |
download | rails-9f1b0b32e27af668014c6fb21edbfc869f36dd2d.tar.gz rails-9f1b0b32e27af668014c6fb21edbfc869f36dd2d.tar.bz2 rails-9f1b0b32e27af668014c6fb21edbfc869f36dd2d.zip |
use attr_reader and alias methods to access instance variables
-rw-r--r-- | activerecord/lib/active_record/associations/association_proxy.rb | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/associations/association_proxy.rb b/activerecord/lib/active_record/associations/association_proxy.rb index 3a0cda49f8..8e64056a06 100644 --- a/activerecord/lib/active_record/associations/association_proxy.rb +++ b/activerecord/lib/active_record/associations/association_proxy.rb @@ -75,11 +75,6 @@ module ActiveRecord @reflection end - # Returns the \target of the proxy, same as +target+. - def proxy_target - @target - end - # Does the proxy or its \target respond to +symbol+? def respond_to?(*args) proxy_respond_to?(*args) || (load_target && @target.respond_to?(*args)) @@ -143,9 +138,10 @@ module ActiveRecord end # Returns the target of this proxy, same as +proxy_target+. - def target - @target - end + attr_reader :target + + # Returns the \target of the proxy, same as +target+. + alias :proxy_target :target # Sets the target of this proxy to <tt>\target</tt>, and the \loaded flag to +true+. def target=(target) |