0.0
No commit activity in last 3 years
No release in over 3 years
inherits_from provides an interface that allows ActiveRecord models to access other ActiveRecord models as though they were subclassed, while allowing data to be stored in a normalized RDBMS.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

 Project Readme

inherits_from - A gem that provides an inheritance interface for ActiveRecord Models¶ ↑

Introduction¶ ↑

inherits_from address the different paradigms between OO and RDBMS to allow ActiveRecord(AR) objects to inherit from AR objects. Both systems have objects with Behavior, Identity & State. OO objects that inherit from each other should have direct access to all superclasses’ behavior identity and state. RDBMS entities relate to each other. RDBMS entries should normalize state across multiple tables. Because AR stores state in RDBMS, objects that should inherit from other AR objects are required to use composition.

inherits_from provides an interface that allows ActiveRecord models to access other ActiveRecord models as though they were subclassed, while allowing data to be stored in a normalized RDBMS.

Resources¶ ↑

Installation¶ ↑

gem install inherits_from

Git Repository¶ ↑

github.com/itchy/inherits_from

Requirements¶ ↑

inherits_from requires ActiveRecord

Example¶ ↑

class User < ActiveRecord::Base
  has_many :profiles
  # has an attribute of email
end

class Profile < ActiveRecord::Base
  include InheritsFrom
  inherits_from :user # this would be belongs_to if not using inherits_from
end	

p = Profile.first
p.email => provides p.user.email
p.email="new@email.com" => sets the value of p.user.email
p.save => will also save p.user if it is tainted?