我已经安装了Spree gem并按照“入门”中的说法运行它。一切正常,但如果我想进入管理面板的“产品”部分,我会遇到以下错误:
Mysql2::Error: Unknown column 'variants.position' in 'order clause': SELECT `variants`.* FROM `variants` WHERE (`variants`.product_id IN (706676762,569012001,723959550,1025786064,1060500592,248786582,187438981,1035865702,459084718) AND (variants.is_master = 0 AND variants.deleted_at IS NULL)) ORDER BY variants.position ASC
有人面对吗?
编辑:这是我的Gemfile
source 'http://rubygems.org'
gem 'rails', '3.0.7'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2', '~> 0.2.11'
gem 'heroku'
gem 'thin'
gem 'spree', '~> 0.60.0'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
# gem 'ruby-debug'
# gem 'ruby-debug19', :require => 'ruby-debug'
# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri'
# gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'
# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
# group :development, :test do
# gem 'webrat'
# end
gem "test", :path => "test", :require => "test"
答案 0 :(得分:2)
通常,当您按照这些steps安装spree时,您应该在db / migrate中包含一些迁移文件,其中一个包含应用程序缺少的列:
class AddPositionToVariants < ActiveRecord::Migration
def self.up
add_column :variants, :position, :integer
end
def self.down
remove_column :variants, :position
end
end