-
Notifications
You must be signed in to change notification settings - Fork 119
Open
Labels
Description
Strangely my site was working fine when I was using PostgreSQL. Recently I tried it out on MySQL, and now this extension throws an error:
Mysql2::Error: Unknown column 'position' in 'order clause': SELECT `refinery_images`.* FROM `refinery_images` WHERE `refinery_images`.`id` IN (1) ORDER BY position ASC
I fixed it by changing the association in lib/refinery/page_images/extension.rb
:
from:
has_many :images, proc { order('position ASC') }, :through => :image_pages, :class_name => 'Refinery::Image'
to:
has_many :images, proc { includes(:image_pages).order('refinery_image_pages.position ASC') }, :through => :image_pages, :class_name => 'Refinery::Image'
I'm using Rails 4.1.4
Not sure if it's worth making this change to refinerycms-page-images, or whether it's an issue with the rails MySQL2 adapter ?
peresleguine