BigW Consortium Gitlab

Commit 9e2525cb by Andrew8xx8

Association form user to snippets added

parent 5b35000f
...@@ -75,6 +75,7 @@ class User < ActiveRecord::Base ...@@ -75,6 +75,7 @@ class User < ActiveRecord::Base
has_many :team_projects, through: :user_team_project_relationships has_many :team_projects, through: :user_team_project_relationships
# Projects # Projects
has_many :snippets, dependent: :destroy, foreign_key: :author_id, class_name: "Snippet"
has_many :users_projects, dependent: :destroy has_many :users_projects, dependent: :destroy
has_many :issues, dependent: :destroy, foreign_key: :author_id has_many :issues, dependent: :destroy, foreign_key: :author_id
has_many :notes, dependent: :destroy, foreign_key: :author_id has_many :notes, dependent: :destroy, foreign_key: :author_id
......
...@@ -40,6 +40,7 @@ require 'spec_helper' ...@@ -40,6 +40,7 @@ require 'spec_helper'
describe User do describe User do
describe "Associations" do describe "Associations" do
it { should have_one(:namespace) } 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(:users_projects).dependent(:destroy) }
it { should have_many(:groups) } it { should have_many(:groups) }
it { should have_many(:keys).dependent(:destroy) } it { should have_many(:keys).dependent(:destroy) }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment