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

Using kaminari (0.13.0)


但是,当我尝试耙db:migrate时,出现此错误

rake aborted
undefined method `paginates_per' for Carrier::Chain(Table doesn't exist):Class


有人可以为此提出建议吗?我已经从下面的Carrier gem复制了gemfile,并在下面复制了我自己的应用程序的Gemfile

(运营商宝石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试图执行的操作的数据库支持。从运营商自述文件中,您似乎需要在运行db:migrate之前先运行rake carrier:install:migrations。你做完了吗?

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

10-09 02:59