UPDATE March 15, 2009: Good news, Eric Kidd informed me that the patch has been applied to mephisto edge, commit

Currently in mephisto edge, which is maintained and developed by Eric Kidd (aka emk) 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).

After reporting the ticket on lighthouse I found out what the bug was. So..

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.

‘nough said, voila le patch

Sorry, comments are closed for this article.