Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown column 'position' in 'order clause' #113

Open
asgeo1 opened this issue Oct 15, 2014 · 1 comment
Open

Unknown column 'position' in 'order clause' #113

asgeo1 opened this issue Oct 15, 2014 · 1 comment
Labels

Comments

@asgeo1
Copy link

asgeo1 commented Oct 15, 2014

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 ?

@bricesanchez
Copy link
Member

Did you find a solution @asgeo1 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants