# ActiveRecord private method called

**URL:** <https://www.ruby-forum.com/t/activerecord-private-method-called/155631>\
**Category:** Rails\
**Created:** [December 15, 2008, 12:55am UTC](https://www.ruby-forum.com/t/activerecord-private-method-called/155631 "2008-12-15T00:55:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrius\_c](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e19adc/32.png) [@andrius\_c](https://www.ruby-forum.com/u/andrius_c)\
**Post date:** [December 15, 2008, 12:55am UTC](https://www.ruby-forum.com/t/activerecord-private-method-called/155631/1 "2008-12-15T00:55:04Z")

</div>

Ok so i just upgraded to rails 2.2.2 and now i’m getting error  
“Attempt to call private method”. I found out that this is because my  
planet model has attribute named y, which seems is a private attribute  
in ActiveRecord::Base. I guess rails didn’t check if it overwrites  
private methods before and now it does. Problem is that i have so many  
calls to this attribute that changing name is not really an option. I  
was thinking about introducing public methods for it, but thought it  
might break some ActiveRecord internals. Maybe someone knows any other  
option?

---

<div class="post-metadata">

**Author:** ![andrius\_c](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e19adc/32.png) [@andrius\_c](https://www.ruby-forum.com/u/andrius_c)\
**Post date:** [December 15, 2008, 10:13am UTC](https://www.ruby-forum.com/t/activerecord-private-method-called/155631/2 "2008-12-15T10:13:33Z")

</div>

On Dec 14, 11:54 pm, Andrius C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Ok so i just upgraded to rails 2.2.2 and now i’m getting error  
> “Attempt to call private method”. I found out that this is because my  
> planet model has attribute named y, which seems is a private attribute  
> in ActiveRecord::Base. I guess rails didn’t check if it overwrites  
> private methods before and now it does. Problem is that i have so many  
> calls to this attribute that changing name is not really an option. I  
> Well I would still think that’s the best option (and y is hardly a  
> describle option name)  
> was thinking about introducing public methods for it, but thought it  
> might break some ActiveRecord internals. Maybe someone knows any other  
> option?  
> You could try sticking  
> ActiveRecord::Base.send :undef\_method, :y

in an initializer.
