Displaying 3 results from an estimated 3 matches for "reports_to".
Did you mean:
report_stop
2008 Jul 20
10
STI and fixtures
Hi all !
Loading fixtures doens''t seems to associate my 2 objects, do know what''s
wrong ?
In app/
class Manager < Employee
has_many :employees,
:foreign_key => :reports_to
end
class Employee < Person
belongs_to :manager,
:foreign_key => ''reports_to''
end
class Person < ActiveRecord::Base
belongs_to :address
end
fixtures for people
Nicolas:
first_name: Nicolas
type: Employee
reports_to: david
David:
first_name: David...
2006 Jul 28
0
STI hiding attributes
...b 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 :repor...
2007 May 28
5
CTI in ActiveRecord
I search an plugin or gem, but don''t find nothing satisfactory. I
believe to be stranger a technology that nails the DRY, have that create
you vary equal tables, instead of using inheritance.
Exists an soluction for this? I want a solution similar to this:
create_table :people |t| do
t.column :name
t.column :address
end
create_table :customer |t| do
t.column :person_id