Association form user to snippets added

This commit is contained in:
Andrew8xx8 2013-03-24 23:09:59 +04:00
parent 5b35000f16
commit 9e2525cbd0
2 changed files with 2 additions and 0 deletions

View File

@ -75,6 +75,7 @@ class User < ActiveRecord::Base
has_many :team_projects, through: :user_team_project_relationships
# Projects
has_many :snippets, dependent: :destroy, foreign_key: :author_id, class_name: "Snippet"
has_many :users_projects, dependent: :destroy
has_many :issues, dependent: :destroy, foreign_key: :author_id
has_many :notes, dependent: :destroy, foreign_key: :author_id

View File

@ -40,6 +40,7 @@ require 'spec_helper'
describe User do
describe "Associations" do
it { should have_one(:namespace) }
it { should have_many(:snippets).class_name('Snippet').dependent(:destroy) }
it { should have_many(:users_projects).dependent(:destroy) }
it { should have_many(:groups) }
it { should have_many(:keys).dependent(:destroy) }