# Regarding class\_inheritable\_accessor

**URL:** <https://www.ruby-forum.com/t/regarding-class-inheritable-accessor/174034>\
**Category:** Rails\
**Created:** [August 19, 2009, 8:00pm UTC](https://www.ruby-forum.com/t/regarding-class-inheritable-accessor/174034 "2009-08-19T20:00:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![satynos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e9bcb4/32.png) [@satynos](https://www.ruby-forum.com/u/satynos)\
**Post date:** [August 19, 2009, 8:00pm UTC](https://www.ruby-forum.com/t/regarding-class-inheritable-accessor/174034/1 "2009-08-19T20:00:00Z")

</div>

By looking at the implementation of class\_inheritable\_accessor by  
ActiveSupport, looks like it is defining not only class methods as well  
as instance methods. Whats the reason behind defining both class level  
as well as instance level methods. Is there any alternative function  
that defines just the class level methods.

Please see below for my requirement:

I have a model Page for which I would like to define class level  
variable “title” that can be overridden in its subclasses. But I also  
have a column in the pages table by the name “title”. But by using  
class\_inheritable\_accessor, I am getting nil for @page.title.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![satynos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e9bcb4/32.png) [@satynos](https://www.ruby-forum.com/u/satynos)\
**Post date:** [August 19, 2009, 9:15pm UTC](https://www.ruby-forum.com/t/regarding-class-inheritable-accessor/174034/2 "2009-08-19T21:15:49Z")

</div>

Saty N. wrote:

> By looking at the implementation of class\_inheritable\_accessor by  
> ActiveSupport, looks like it is defining not only class methods as well  
> as instance methods. Whats the reason behind defining both class level  
> as well as instance level methods. Is there any alternative function  
> that defines just the class level methods.
> 
> Please see below for my requirement:
> 
> I have a model Page for which I would like to define class level  
> variable “title” that can be overridden in its subclasses. But I also  
> have a column in the pages table by the name “title”. But by using  
> class\_inheritable\_accessor, I am getting nil for @page.title.
> 
> Thanks in advance.

Declaring remove\_method after the declaration of  
class\_inheritable\_accessor seems to do the trick, although not sure  
about the ramifications at this point, partly due to the lack of  
knowledge of why rails is defining the instance methods in the first  
place. Would appreciate if someone could shed the light.

-Satynos
