Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
9e2525cb
Commit
9e2525cb
authored
Mar 24, 2013
by
Andrew8xx8
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Association form user to snippets added
parent
5b35000f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
0 deletions
+2
-0
app/models/user.rb
app/models/user.rb
+1
-0
spec/models/user_spec.rb
spec/models/user_spec.rb
+1
-0
No files found.
app/models/user.rb
View file @
9e2525cb
...
...
@@ -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
...
...
spec/models/user_spec.rb
View file @
9e2525cb
...
...
@@ -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
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment