Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OHR Support
Manage
Activity
Members
Labels
Plan
Issues
97
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
OHR Support
Commits
1fae552c
Commit
1fae552c
authored
13 years ago
by
Eric Davis
Browse files
Options
Downloads
Patches
Plain Diff
[#467] Fix Journal#journaled to prevent uninitialized constant Journal::Journaled
parent
7c4abeb8
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/models/journal.rb
+6
-1
6 additions, 1 deletion
app/models/journal.rb
test/unit/journal_test.rb
+7
-0
7 additions, 0 deletions
test/unit/journal_test.rb
with
13 additions
and
1 deletion
app/models/journal.rb
+
6
−
1
View file @
1fae552c
...
...
@@ -23,7 +23,12 @@ class Journal < ActiveRecord::Base
# Make sure each journaled model instance only has unique version ids
validates_uniqueness_of
:version
,
:scope
=>
[
:journaled_id
,
:type
]
belongs_to
:journaled
,
:touch
=>
true
# Define a default class_name to prevent `uninitialized constant Journal::Journaled`
# subclasses will be given an actual class name when they are created by aaj
#
# e.g. IssueJournal will get :class_name => 'Issue'
belongs_to
:journaled
,
:touch
=>
true
,
:class_name
=>
'Journal'
belongs_to
:user
# ActiveRecord::Base#changes is an existing method, so before serializing the +changes+ column,
...
...
This diff is collapsed.
Click to expand it.
test/unit/journal_test.rb
+
7
−
0
View file @
1fae552c
...
...
@@ -94,4 +94,11 @@ class JournalTest < ActiveSupport::TestCase
assert_not_equal
start
,
@issue
.
reload
.
updated_on
end
test
"accessing #journaled on a Journal should not error (parent class)"
do
journal
=
Journal
.
new
assert_nothing_raised
do
assert_equal
nil
,
journal
.
journaled
end
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment