Displaying 2 results from an estimated 2 matches for "employee_number".
2006 Jul 10
3
Problem with migrations
...gration add_employee_data
>ruby script\generate model cost_codes
>ruby script\generate migration add_cost_code_data
Then inside the first 3 migrations everything goes ok -
001
class CreateEmployees < ActiveRecord::Migration
def self.up
create_table :employees do |t|
t.column :employee_number, :integer
t.column :name, :string
t.column :location, :string
t.column :department, :integer
t.column :company_code, :string
end
end
def self.down
drop_table :employees
end
end
002
class AddEmployeeData < ActiveRecord::Migration
def self.up
Empl...
2006 Jul 17
14
REST Relationship Models
I''m trying to figure out an elegant way to do this:
I have the following three tables:
people, employer, employees
And consequently the following three models:
class Person < ActiveRecord::Base
end
class Employer < ActiveRecord::Base
has_many :employees
end
class Employee < ActiveRecord::Base
belongs_to :person
belongs_to :employer
end
I want to be able to say: