Bug #506
Categories fail with error
| Status : | Closed | Start : | ||
| Priority : | Normal | Due date : | ||
| Assigned to : | tobi - | % Done : | 0% |
|
| Category : | frontend | |||
| Target version : | - | |||
| Resolution : | fixed |
Description
On svn head (702) I have issues with some (not all) of my categories. On http://fak3r.com, if I hit any of these categories: bsd, muzak, art, geek, blah or rant Typo blows up, but my other categories: linux, work fine! Not sure if it's got some cached somewhere or what. The error and full trace can be seen by selecting any of those categories, or here:
-----
ActiveRecord::ReadOnlyRecord in Articles#category
Showing app/views/articles/_article.rhtml where line #4 raised:
ActiveRecord::ReadOnlyRecord
Extracted source (around line #4):
1: <h2><%= article_link article.title, article %></h2>
2: <p class="auth">Posted by <%= author_link(article) %>
3: <%= js_distance_of_time_in_words_to_now article.created_at %></p>
4: <%= article_html(article,:body) %>
Trace of template inclusion: /app/views/articles/index.rhtml
Application Trace | Framework Trace | Full Trace
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/base.rb:1141:in @save_without_validation'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/validations.rb:661:in @save_without_transactions'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/transactions.rb:126:in @save'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/transactions.rb:126:in @transaction'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/transactions.rb:91:in @transaction'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/transactions.rb:118:in @transaction'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/transactions.rb:126:in @save'
./script/../config/..//app/models/content.rb:60:in @html'
./script/../config/..//app/models/content.rb:55:in @each'
./script/../config/..//app/models/content.rb:55:in @html'
./script/../config/..//app/helpers/application_helper.rb:101:in @article_html'
./script/../config/..//app/views//articles/_article.rhtml:4
./script/../config/..//lib/renderfix.rb:12:in @render_file'
./script/../config/..//app/views//articles/index.rhtml:3
./script/../config/..//app/views//articles/index.rhtml:1:in @each'
./script/../config/..//app/views//articles/index.rhtml:1
./script/../config/..//lib/renderfix.rb:12:in @render_file'
./script/../config/../app/controllers/articles_controller.rb:88:in @category'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/base.rb:1141:in @save_without_validation'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/validations.rb:661:in @save_without_transactions'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/transactions.rb:126:in @save'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/transactions.rb:126:in @transaction'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/transactions.rb:91:in @transaction'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/transactions.rb:118:in @transaction'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/transactions.rb:126:in @save'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_view/base.rb:269:in @send'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_view/base.rb:269:in @compile_and_render_template'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_view/base.rb:245:in @render_template'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_view/base.rb:206:in @+render_file'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_view/base.rb:221:in @render'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_view/partials.rb:58:in @render_partial'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_view/partials.rb:57:in @benchmark'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_view/partials.rb:57:in @render_partial'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_view/base.rb:269:in @send'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_view/base.rb:269:in @compile_and_render_template'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_view/base.rb:245:in @render_template'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_view/base.rb:206:in @+render_file'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/base.rb:640:in @render_file'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/base.rb:582:in @render_with_no_layout'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/base.rb:632:in @render_action'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/base.rb:599:in @render_with_no_layout'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/layout.rb:215:in @render_without_benchmark'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/benchmarking.rb:53:in @render'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/benchmarking.rb:53:in @measure'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/benchmarking.rb:53:in @render'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/base.rb:831:in @send'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/base.rb:831:in @perform_action_without_filters'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/filters.rb:295:in @perform_action_without_benchmark'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/benchmarking.rb:69:in @perform_action_without_rescue'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/benchmarking.rb:69:in @measure'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/benchmarking.rb:69:in @perform_action_without_rescue'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/rescue.rb:82:in @perform_action'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/base.rb:364:in @send'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/base.rb:364:in @process_without_session_management_support'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/session_management.rb:116:in @process'
/usr/local/lib/ruby/gems/1.8/gems/rails-0.14.1/lib/dispatcher.rb:36:in @dispatch'
/usr/local/lib/ruby/gems/1.8/gems/rails-0.14.1/lib/webrick_server.rb:117:in @handle_dispatch'
/usr/local/lib/ruby/gems/1.8/gems/rails-0.14.1/lib/webrick_server.rb:83:in @service'
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in @service'
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in @run'
/usr/local/lib/ruby/1.8/webrick/server.rb:155:in @start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:144:in @start'
/usr/local/lib/ruby/1.8/webrick/server.rb:144:in @start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:94:in @start'
/usr/local/lib/ruby/1.8/webrick/server.rb:89:in @each'
/usr/local/lib/ruby/1.8/webrick/server.rb:89:in @start'
/usr/local/lib/ruby/1.8/webrick/server.rb:79:in @start'
/usr/local/lib/ruby/1.8/webrick/server.rb:79:in @start'
/usr/local/lib/ruby/gems/1.8/gems/rails-0.14.1/lib/webrick_server.rb:69:in @dispatch'
./script/server:49
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/base.rb:1141:in @save_without_validation'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/validations.rb:661:in @save_without_transactions'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/transactions.rb:126:in @save'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/transactions.rb:126:in @transaction'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/transactions.rb:91:in @transaction'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/transactions.rb:118:in @transaction'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/transactions.rb:126:in @save'
./script/../config/..//app/models/content.rb:60:in @html'
./script/../config/..//app/models/content.rb:55:in @each'
./script/../config/..//app/models/content.rb:55:in @html'
./script/../config/..//app/helpers/application_helper.rb:101:in @article_html'
./script/../config/..//app/views//articles/_article.rhtml:4
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_view/base.rb:269:in @send'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_view/base.rb:269:in @compile_and_render_template'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_view/base.rb:245:in @render_template'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_view/base.rb:206:in @+render_file'
./script/../config/..//lib/renderfix.rb:12:in @render_file'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_view/base.rb:221:in @render'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_view/partials.rb:58:in @render_partial'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_view/partials.rb:57:in @benchmark'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_view/partials.rb:57:in @render_partial'
./script/../config/..//app/views//articles/index.rhtml:3
./script/../config/..//app/views//articles/index.rhtml:1:in @each'
./script/../config/..//app/views//articles/index.rhtml:1
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_view/base.rb:269:in @send'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_view/base.rb:269:in @compile_and_render_template'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_view/base.rb:245:in @render_template'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_view/base.rb:206:in @+render_file'
./script/../config/..//lib/renderfix.rb:12:in @render_file'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/base.rb:640:in @render_file'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/base.rb:582:in @render_with_no_layout'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/base.rb:632:in @render_action'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/base.rb:599:in @render_with_no_layout'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/layout.rb:215:in @render_without_benchmark'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/benchmarking.rb:53:in @render'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/benchmarking.rb:53:in @measure'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/benchmarking.rb:53:in @render'
./script/../config/../app/controllers/articles_controller.rb:88:in @category'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/base.rb:831:in @send'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/base.rb:831:in @perform_action_without_filters'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/filters.rb:295:in @perform_action_without_benchmark'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/benchmarking.rb:69:in @perform_action_without_rescue'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/benchmarking.rb:69:in @measure'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/benchmarking.rb:69:in @perform_action_without_rescue'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/rescue.rb:82:in @perform_action'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/base.rb:364:in @send'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/base.rb:364:in @process_without_session_management_support'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.1/lib/action_controller/session_management.rb:116:in @process'
/usr/local/lib/ruby/gems/1.8/gems/rails-0.14.1/lib/dispatcher.rb:36:in @dispatch'
/usr/local/lib/ruby/gems/1.8/gems/rails-0.14.1/lib/webrick_server.rb:117:in @handle_dispatch'
/usr/local/lib/ruby/gems/1.8/gems/rails-0.14.1/lib/webrick_server.rb:83:in @service'
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in @service'
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in @run'
/usr/local/lib/ruby/1.8/webrick/server.rb:155:in @start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:144:in @start'
/usr/local/lib/ruby/1.8/webrick/server.rb:144:in @start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:94:in @start'
/usr/local/lib/ruby/1.8/webrick/server.rb:89:in @each'
/usr/local/lib/ruby/1.8/webrick/server.rb:89:in @start'
/usr/local/lib/ruby/1.8/webrick/server.rb:79:in @start'
/usr/local/lib/ruby/1.8/webrick/server.rb:79:in @start'
/usr/local/lib/ruby/gems/1.8/gems/rails-0.14.1/lib/webrick_server.rb:69:in @dispatch'
./script/server:49
Request
Parameters: {"id"=>"muzak", "page"=>nil}
Show session dump
---
:user: !ruby/object:User
attributes:
name: fak3r
id: "1"
login: fak3r
password: 97a08e7b7e58693dcc39aff27651800e8a7f8e82
email: fak3r@fak3r.com
:return_to:
flash: !ruby/hash:ActionController::Flash::FlashHash {}
Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"}
Associated revisions
Revision 1acf608084684188fa6dd07f3c2e0e88f15415cf
Add previous/next helpers. Closes #506.
git-svn-id: http://svn.typosphere.org/typo/trunk@725 820eb932-12ee-0310-9ca8-eeb645f39767
History
10/28/2005 09:08 AM - Victor Jalencas -
This patch fixes it for me, both for category and tag listings. Now :joins makes all records returned be readonly by default, and if they need to have their article_html updated they won't be able to be saved. Why would they need that? because they are imported from other systems, for example
Index: article.rb
===================================================================
--- article.rb (revision 706)
+++ article.rb (working copy)
@@ -92,7 +92,7 @@
AND #{Article.table_name}.id = articles_categories.article_id
AND articles_categories.category_id = ? }, category.id],
:joins => ", #{Article.table_name_prefix}articles_categories#{Article.table_name_suffix} articles_categories",
- :order => "created_at DESC"}.merge(options))
+ :order => "created_at DESC", :readonly=>false}.merge(options))
end
def self.find_published_by_tag_name(tag_name, options = {})
@@ -104,7 +104,7 @@
AND #{Article.table_name}.id = articles_tags.article_id
AND articles_tags.tag_id = ? }, tag.id],
:joins => ", #{Article.table_name_prefix}articles_tags#{Article.table_name_suffix} articles_tags",
- :order => "created_at DESC"}.merge(options))
+ :order => "created_at DESC", :readonly=>false}.merge(options))
end
# Fulltext searches the body of published articles
