Skip to content

Instantly share code, notes, and snippets.

@thomasstr
Created October 9, 2013 11:00
Show Gist options
  • Save thomasstr/6899520 to your computer and use it in GitHub Desktop.
Save thomasstr/6899520 to your computer and use it in GitHub Desktop.
class Project < ActiveRecord::Base
# Sjekker at kolonnen navn er fyllt ut.
validates :name, presence: true
validates :client_id, presence: true
belongs_to :admin
belongs_to :client
has_many :registerhours, dependent: :destroy
end
class Registerhour < ActiveRecord::Base
belongs_to :project
end
create_table "registerhours", force: true do |t|
t.date "date_today"
t.time "from"
t.time "to"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "project_id"
t.integer "admin_id"
t.string "timetype"
t.text "notes"
t.boolean "approved", default: false
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment