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
8b13992c
Commit
8b13992c
authored
Jun 17, 2011
by
Eric Davis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Print any errors when saving the initial journal instead of aborting
parent
52b83da8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
20100714111653_build_initial_journals_for_acts_as_journalized.rb
...4111653_build_initial_journals_for_acts_as_journalized.rb
+15
-7
No files found.
db/migrate/20100714111653_build_initial_journals_for_acts_as_journalized.rb
View file @
8b13992c
...
...
@@ -42,14 +42,22 @@ class BuildInitialJournalsForActsAsJournalized < ActiveRecord::Migration
elsif
o
.
respond_to?
(
:user
)
new_journal
.
user
=
o
.
user
end
new_journal
.
save
new_journal
.
reload
if
new_journal
.
save
new_journal
.
reload
# Backdate journal
if
o
.
respond_to?
(
:created_at
)
new_journal
.
update_attribute
(
:created_at
,
o
.
created_at
)
elsif
o
.
respond_to?
(
:created_on
)
new_journal
.
update_attribute
(
:created_at
,
o
.
created_on
)
# Backdate journal
if
o
.
respond_to?
(
:created_at
)
new_journal
.
update_attribute
(
:created_at
,
o
.
created_at
)
elsif
o
.
respond_to?
(
:created_on
)
new_journal
.
update_attribute
(
:created_at
,
o
.
created_on
)
end
else
if
new_journal
.
errors
.
count
==
1
&&
new_journal
.
errors
.
first
[
0
]
==
"version"
# Skip, only error was from creating the initial journal for a record that already had one.
else
puts
"ERROR: errors creating the initial journal for
#{
o
.
class
.
to_s
}
#
#{
o
.
id
.
to_s
}
:"
puts
"
#{
new_journal
.
errors
.
full_messages
.
inspect
}
"
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