Please sign in to comment.
multisite: Fix broken article versions
[This is an edited version of the author's blog post at http://inormalized.com/2009/2/19/how-to-fix-broken-article-versions-in-emk-mephisto-edge-post-0-8-1. -Eric] Currently in mephisto edge, article versions are broken. More precisely, the bug comes up ONLY when the installation operates in multisite mode (or even more precisely, when there are at least two articles belonging to two different sites). The problem is how acts_as_versioned is being used. An acts_as_versioned record has among others an “id” column (the default id that ActiveRecord requires) and a “version” column. Currently Mephisto falsely does the following inside \app\controllers\admin\articles_controller.rb on line 38 (edit action)... @version = params[:version] ? @article.versions.find(params[:version]) : @article or raise(ActiveRecord::RecordNotFound) the whole problem is the find(params[:version]) . What happens here is, that we lookup an article’s version by searching for its id instead of for its version column (even though we do use the correct :version parameter.) So this has to change to find_by_version(params[:version]) and thus become.. @version = params[:version] ? @article.versions.find_by_version(params[:version]) : @article or raise(ActiveRecord::RecordNotFound) Notice though that this doesn’t break in a single-site installation, because in this case id and version bot get the same (concurrent) increment. That is because all articles belong the same one and only Site instance.
- Loading branch information...
Showing with 1 addition and 1 deletion.