I’ve written an extension to AR to allow hiding of attributes(aka
columns) in AR objects. If there’s interest in it I’ll roll it up
into a plugin. Here’s an example:
(straight from Agile Web Dev)
The table
create table people (
id int not null auto_increment,
type varchar(20) not null,
/* common attributes */
name varchar(100) not null,
email varchar(100) not null,
/* attributes for type = Customer */
balance decimal(10,2),
/* attributes for type = Employee */
reports_to int,
dept int,
/* attributes for type = Manager /
/ – none – */
)
class Person < ActiveRecord::Base
end
class Customer < Person
hides_attribute :reports_to, :dept
end
class Employee < Person
hides_attribute :balance
end
class Manager < Employee
hides_attribute :reports_to, :dept
end
The extension will put out the attributes specified in hides_attribute
so a Customer
object will no longer respond to reports_to, reports_to=, dept, or dept=
So any interest?
-wilig