gpt4 book ai didi

ruby-on-rails - rails : undefined method 'paginates_per'

转载 作者:行者123 更新时间:2023-12-04 06:03:04 26 4
gpt4 key购买 nike

我正在安装一个名为 Carrier 的 gem https://github.com/stanislaw/carrier/blob/master/Gemfile进入 Rails 3.2.1 应用程序。它使用 Kaminari,当我在 Gemfile 中添加 gem“carrier”后进行捆绑安装时,它表明我正在使用 kaminari

Using kaminari (0.13.0) 

但是,当我尝试 rake db:migrate 时,出现此错误
rake aborted
undefined method `paginates_per' for Carrier::Chain(Table doesn't exist):Class

任何人都可以建议解决这个问题吗?我已经从下面的 Carrier gem 中复制了 gemfile,并在下面复制了我自己的应用程序的 Gemfile

(载体 gem Gemfile)
来源“http://rubygems.org”
gem 'require_all'
gem 'kaminari'
gem 'unread'
gem 'sugar-high'
gem 'sweetloader'

group :development, :test do
gem 'rails', '~> 3.1.0'
gem 'unicorn'
gem 'mysql2'
gem 'devise'
gem 'rake-kit'
gem 'cutter'
gem "jeweler", ">= 1.6.4"
gem "rspec-rails", '>= 2.5'
end

group :test do
gem 'capybara'
gem 'factory_girl'
gem 'spork'
gem "launchy"
gem 'shoulda'
end

我的入门应用程序的 Gemfile
source 'https://rubygems.org'

gem 'rails', '3.2.1'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'pg'
gem 'devise'
gem 'carrier'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer'

gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'

更新 这些是我运行 install:migrations 时安装的迁移
rake carrier:install:migrations
Copied migration 20120229055640_create_messages.carrier.rb from carrier
Copied migration 20120229055641_create_chains.carrier.rb from carrier

更新

我试图在另一个 git 分支上再次重新安装它这次我在运行 rake db:migrate 时遇到了一个稍微不同的错误
rake aborted!
undefined method `acts_as_readable' for Carrier::Message(Table doesn't exist):Class

Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)

最佳答案

您似乎缺少一些支持 Carrier 尝试执行的操作的数据库。从运营商自述文件来看,您似乎需要运行 rake carrier:install:migrations在运行 db:migrate 之前。你这样做了吗?

关于ruby-on-rails - rails : undefined method 'paginates_per' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9494486/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com