问题描述
我正在安装名为Carrier的gem https://github.com/stanislaw/运营商/blob/master/Gemfile 导入Rails 3.2.1应用.它使用Kaminari,当我在Gemfile中添加gem"carrier"后进行捆绑安装时,表明我正在使用kaminari
I'm installing a gem called Carrier https://github.com/stanislaw/carrier/blob/master/Gemfile into a Rails 3.2.1 app. It uses Kaminari and when I did bundle install after adding gem "carrier" to my Gemfile, it showed that I was using kaminari
Using kaminari (0.13.0)
但是,当我尝试耙db:migrate时,出现此错误
However, when I tried to rake db:migrate, I got this error
rake aborted
undefined method `paginates_per' for Carrier::Chain(Table doesn't exist):Class
有人可以为此提出建议吗?我已经从下面的Carrier gem复制了gemfile,并在下面复制了我自己的应用程序的Gemfile
Can anyone suggest a fix for this? I've copied the gemfile from the Carrier gem below and the Gemfile for my own app below that
(载体宝石Gemfile) 来源"http://rubygems.org"
(Carrier gem Gemfile) source "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 for my starter app
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
Update These are the migrations it installed when I ran 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时遇到了一个略有不同的错误
I tried to reinstall it again on another git branch it this time I got a slightly different error when I ran 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试图做的事情的数据库支持.从运营商自述文件中,您似乎需要在运行db:migrate之前先运行rake carrier:install:migrations
.你做完了吗?
You appear to be missing some database backing for what Carrier is trying to do. From the Carrier readme, it looks like you need to run rake carrier:install:migrations
before running db:migrate. Have you done that?
这篇关于Rails:未定义的方法'paginates_per'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!