blob: 6d01490844879c70a9d0abdf3e3d76f54a3bc8f9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
|
class Developer < ActiveRecord::Base
has_and_belongs_to_many :projects
validates_inclusion_of :salary, :in => 50000..200000
validates_length_of :name, :within => 3..20
end
DeveloperSalary = Struct.new(:amount)
class DeveloperWithAggregate < ActiveRecord::Base
self.table_name = 'developers'
composed_of :salary, :class_name => 'DeveloperSalary', :mapping => [%w(salary amount)]
end
|