Migration for rendered_notes does not work - Fix attached
I installed 2.1as of this morning (with the rendered notes in the db). Install and migration went fine (had to disable zentest and fix permissions on /public/stylesheets and /public/javascripts).
When I opened up my homepage and clicked on 'toggle notes' the notes weren't there, only a thick yellow line where they should be (i.e., rendering a 'NULL' note). After I recovered from cardiac arrest I clicked 'edit' on a todo and the note was still there, and after clicking 'update' it showed up on the homepage. However, reloading the homepage made it disappear again.
Tracked it down to a missing 'self' in the todo model and created a new migration to fix the database.
Patch attached. So far so good, will test some more later.
When I opened up my homepage and clicked on 'toggle notes' the notes weren't there, only a thick yellow line where they should be (i.e., rendering a 'NULL' note). After I recovered from cardiac arrest I clicked 'edit' on a todo and the note was still there, and after clicking 'update' it showed up on the homepage. However, reloading the homepage made it disappear again.
Tracked it down to a missing 'self' in the todo model and created a new migration to fix the database.
Patch attached. So far so good, will test some more later.
Leave a comment
on 2012-04-12 22:51 *
By cfrankct
Attachment render_notes.patch added
Attachment render_notes.patch added
file:dI1C-WHmmr4y8racwqjQXA
Diff for app/models/todo.rb and new migration
Diff for app/models/todo.rb and new migration
Thanks. I took over your fix. I did not add the migration though, because it will cause a complete rerun of generating all rendered_notes, even for those who were not affected by the bug.
I've posted on the mailing list that
will do the same :-)
I've posted on the mailing list that
bundle exec rake db:rollback
bundle exec rake db:migrate
will do the same :-)
Upgrading from 2.1RC1 to 2.1, I got the following error message that seems very related:
Upgrading seemed to went well:
Any idea on how to fix this?
Processing TodosController#index (for 192.168.1.10 at 2012-04-20 09:18:01) [GET]
Rendering template within layouts/standard
Rendering todos/index
ActionView::TemplateError (undefined method `rendered_notes' for #<Todo:0xb4fd82ac>) on line #36 of app/views/todos/_todo.html.erb:
33: <%= tag_list(todo) %>
34: <%= deferred_due_date(todo) %>
35: <%= project_and_context_links( todo, parent_container_type, :suppress_context => suppress_context, :suppress_project => suppress_project ) %>
36: <%= collapsed_notes_image(todo) unless todo.notes.blank? %>
37: <%= collapsed_successors_image(todo) if todo.has_pending_successors %>
38: </div>
39: </div>
app/helpers/todos_helper.rb:68:in `collapsed_notes_image'
app/helpers/todos_helper.rb:68:in `collapsed_notes_image'
app/views/todos/_todo.html.erb:36
app/views/contexts/_context.rhtml:18:in `_run_rhtml_app47views47contexts47_context46rhtml_locals_collapsible_context_context_counter_object'
app/views/todos/index.html.erb:9
app/controllers/todos_controller.rb:1205:in `render_todos_html'
app/controllers/todos_controller.rb:26:in `index'
/usr/lib/ruby/1.8/phusion_passenger/rack/request_handler.rb:92:in `process_request'
/usr/lib/ruby/1.8/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
/usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:418:in `start_request_handler'
/usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:358:in `handle_spawn_application'
/usr/lib/ruby/1.8/phusion_passenger/utils.rb:184:in `safe_fork'
/usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:354:in `handle_spawn_application'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:163:in `start'
/usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:213:in `start'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:154:in `spawn_application'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
/usr/lib/phusion_passenger/passenger-spawn-server:61
Rendering /var/lib/tracks-2.1/public/500.html (500 Internal Server Error)
Upgrading seemed to went well:
root@glaciere:/var/lib/tracks# bundle exec rake db:migrate RAILS_ENV=production
NOTE: Gem::Specification#has_rdoc= is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem::Specification#has_rdoc= called from /var/lib/tracks-2.1/vendor/gems/has_many_polymorphs-2.13/has_many_polymorphs.gemspec:15
.
(in /var/lib/tracks-2.1)
Please install RDoc 2.4.2+ to generate documentation.
== AddRenderedNotes: migrating ===============================================
-- add_column(:todos, "rendered_notes", :text)
-> 0.0391s
-- Clearing show_from dates from completed todos
-- Generating new column values from notes. This may take a while.
Done: 43 / 43
== AddRenderedNotes: migrated (0.2729s) ======================================
Any idea on how to fix this?