Rails: undefined method 'paginates_per'

别来无恙 提交于 2019-12-13 14:02:06

问题


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) 

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

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

(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'

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

Update

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)

回答1:


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?



来源:https://stackoverflow.com/questions/9494486/rails-undefined-method-paginates-per

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!