0

我想将博客与我现有的 Rails 应用程序集成,我使用 gem refinerycms-blog 并按照教程 https://github.com/refinery/refinerycms-blog

迁移时出现此错误

uninitialized constant Refinery::Blog::Post::FriendlyId/home/love/.rvm/gems/ruby-1.9.3-p194/gems/refinerycms-blog-2.0.5/app/models/refinery/blog/post.rb:7:in `<class:Post>'
/home/love/.rvm/gems/ruby-1.9.3-p194/gems/refinerycms-blog-2.0.5/app/models/refinery/blog/post.rb:6:in `<module:Blog>'
/home/love/.rvm/gems/ruby-1.9.3-p194/gems/refinerycms-blog-2.0.5/app/models/refinery/blog/post.rb:5:in `<module:Refinery>'
/home/love/.rvm/gems/ruby-1.9.3-p194/gems/refinerycms-blog-2.0.5/app/models/refinery/blog/post.rb:4:in `<top (required)>'
/home/love/rails/nabthat/db/migrate/20130813172727_create_blog_structure.refinery_blog.rb:5:in `up'
/home/love/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.3/lib/active_record/migration.rb:410:in `block (2 levels) in migrate'
/home/love/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.3/lib/active_record/migration.rb:410:in `block in migrate'
/home/love/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:119:in `with_connection'
/home/love/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.3/lib/active_record/migration.rb:389:in `migrate'
/home/love/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.3/lib/active_record/migration.rb:528:in `migrate'
/home/love/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.3/lib/active_record/migration.rb:720:in `block (2 levels) in migrate'
/home/love/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.3/lib/active_record/migration.rb:775:in `call'
/home/love/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.3/lib/active_record/migration.rb:775:in `block in ddl_transaction'
/home/love/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/home/love/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.3/lib/active_record/transactions.rb:208:in `transaction'
/home/love/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.3/lib/active_record/migration.rb:775:in `ddl_transaction'
/home/love/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.3/lib/active_record/migration.rb:719:in `block in migrate'
/home/love/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.3/lib/active_record/migration.rb:700:in `each'
/home/love/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.3/lib/active_record/migration.rb:700:in `migrate'
/home/love/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.3/lib/active_record/migration.rb:570:in `up'
/home/love/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.3/lib/active_record/migration.rb:551:in `migrate'
/home/love/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.3/lib/active_record/railties/databases.rake:153:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:migrate

我该如何解决这个问题,或者有没有更好的博客可用

4

2 回答 2

0

我在 github 中找到了一个与您的问题相匹配的链接,https://github.com/refinery/refinerycms-blog/issues/296。如前所述,他们已经解决了这个问题。

好像你的refinerycms-blog的版本太低了,试试gem 'refinerycms-blog', '~> 2.1.0'还是gem 'refinerycms-blog', :git => 'https://github.com/refinery/refinerycms-blog.git'换最新版。

希望能帮助到你 :)

于 2013-08-14T03:45:41.380 回答
0

对于 rails 4.1.5,打开您的 Gemfile 并添加:

gem 'refinerycms-blog', git: 'https://github.com/refinery/refinerycms-blog', branch: 'master'

注意:如果还安装了refinerycms-page-images 扩展,请确保gem refinerycms-blog 位于gem 'refinerycms-page-images' 之前。

于 2015-05-20T13:38:15.030 回答