refinery cms-blog在迁移时显示错误

时间:2013-08-14 01:22:35

标签: ruby-on-rails blogs refinerycms

我想将博客与我现有的rails app集成, 我使用了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

我如何解决这个问题,或者是否有更好的博客

2 个答案:

答案 0 :(得分: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'获取最新版本。

希望有所帮助:)

答案 1 :(得分:0)

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

WHILE cnt > 0
LOOP
BEGIN
      SET biggestID = biggestID + 1
      INSERT INTO exemplar (
                  id_exemplar,
                  id_livro
                  )
      VALUES      (
                  :new.biggestID,
                  :new.id_livro
                  );
      SET cnt = cnt - 1
    END;
END LOOP;

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