Hi David,

Thanks for your response.  attribute_A is just an attribute in a model
that is a subclass of ActiveRecord::Base.  attribute_A is of type
integer.

The reason I used "super" is because I just wanted to assign the value
of "val" to attribute_A in the private setter method "attribute_A="  I
can't say self.attribute_A = val because that is calling the private
method I am defining.

Thanks.

LBD

On Jul 19, 6:39 pm, "David A. Black" <[email protected]> wrote:
> 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