Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
OHR Support
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
97
Issues
97
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
OHR Support
Commits
1fae552c
Commit
1fae552c
authored
Jul 08, 2011
by
Eric Davis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[#467] Fix Journal#journaled to prevent uninitialized constant Journal::Journaled
parent
7c4abeb8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
journal.rb
app/models/journal.rb
+6
-1
journal_test.rb
test/unit/journal_test.rb
+7
-0
No files found.
app/models/journal.rb
View file @
1fae552c
...
@@ -23,7 +23,12 @@ class Journal < ActiveRecord::Base
...
@@ -23,7 +23,12 @@ class Journal < ActiveRecord::Base
# Make sure each journaled model instance only has unique version ids
# Make sure each journaled model instance only has unique version ids
validates_uniqueness_of
:version
,
:scope
=>
[
:journaled_id
,
:type
]
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
belongs_to
:user
# ActiveRecord::Base#changes is an existing method, so before serializing the +changes+ column,
# ActiveRecord::Base#changes is an existing method, so before serializing the +changes+ column,
...
...
test/unit/journal_test.rb
View file @
1fae552c
...
@@ -94,4 +94,11 @@ class JournalTest < ActiveSupport::TestCase
...
@@ -94,4 +94,11 @@ class JournalTest < ActiveSupport::TestCase
assert_not_equal
start
,
@issue
.
reload
.
updated_on
assert_not_equal
start
,
@issue
.
reload
.
updated_on
end
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
end
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