狂欢管理面板不工作

发布于 2024-12-01 04:05:55 字数 1367 浏览 2 评论 0原文

我已经安装了 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"

I've install Spree gem and run it as it wrote in Getting Started. All works fine but if I want to go in the Products section in admin panel I have the following error:

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

Anyone faced that?

EDIT: Here is my 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"

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

完美的未来在梦里 2024-12-08 04:05:55

通常,当您按照这些步骤安装 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

Normally when you install spree by following these steps, you should have some migration files inside db/migrate, one of them contain the missing column for your application :

class AddPositionToVariants < ActiveRecord::Migration
  def self.up
    add_column :variants, :position, :integer
  end

  def self.down
    remove_column :variants, :position
  end
end
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文