Hi --

On Sun, 19 Jul 2009, Ease Bus wrote:

> Hi,
> 
> I would like to rename the setter of "attribute_A" with the following:
> 
> def set_attribute_A(val)
>     self.attribute_A = val
> end
> 
> private
> 
> def attribute_A=(val)
>     super
> end
> 
> But then I get "NoMethodError: Attempt to call private method"  I thought 
> that a private method is
> accessible from within the same instance.

There's not quite enough information in the code you've got here to
see what's going on. Do you have a superclass with a definition for
the attribute_A= method? (I'm trying to figure out why you're calling
super.)


David

-- 
David A. Black / Ruby Power and Light, LLC
Ruby/Rails consulting & training: http://www.rubypal.com
Now available: The Well-Grounded Rubyist (http://manning.com/black2)
Training! Intro to Ruby, with Black & Kastner, September 14-17
(More info: http://rubyurl.com/vmzN)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to