1

http://refinerycms.com/guides/getting-started#rails-application-templatesで Refinery CMS の使用に関するチュートリアルを実行し、

6 最初のエンジンでリファイナリーを拡張する

実行すると言う

rails generate refinery:engine singular_model_name attribute:type [attribute:type ...]

それから走る

rails generate refinery:engine event title:string date:datetime photo:image blurb:text

その後、残りを実行しましたが、実行しようとしたときに実行する必要があるというエラーが発生したrake db:migrateため、機能していないようです。アプリをローカルで実行してみましたが、これが得られましたrake db:seedrake db:migrate

イベント

これはターミナルのどこかにあり、関連しているようです

ActionView::Template::Error (Could not find table 'refinery_events'):
1: <%= render 'refinery/admin/search_header', :url => refinery.events_admin_events_path %>
2: <div class='pagination_container'>
3:   <% if @events.any? %>
4:     <%= render 'events' %>
5:   <% else %>
6:     <p>

著者についてもこのエラーが発生しましたが、チュートリアルでは言及されていませんでした

Using refinerycms-events (1.0) from source at vendor/extensions
refinerycms-events at /Users/juan.gallardo/Desktop/myfiles/test-projects/rickrockstar/vendor/extensions/events did not have a valid gemspec.
This prevents bundler from installing bins or native extensions, but that may not affect its functionality.
The validation message from Rubygems was:
  authors may not be empty

Using refinerycms-singular_model_names (1.0) from source at vendor/extensions
refinerycms-singular_model_names at /Users/juan.gallardo/Desktop/myfiles/test-projects/rickrockstar/vendor/extensions/singular_model_names did not have a valid gemspec.
This prevents bundler from installing bins or native extensions, but that may not affect its functionality.
The validation message from Rubygems was:
  authors may not be empty

だから私はプロセスをもう一度やり直しました

jgallardo:rickrockstar juan.gallardo$ rails generate refinery:events
    rake  refinery_events:install:migrations
  append  db/seeds.rb
jgallardo:rickrockstar juan.gallardo$ rake db:migrate
rake aborted!

今回ははっきりと見えましたrake abortedが、とにかくこれを試しました

jgallardo:rickrockstar juan.gallardo$ rake db:seed
You have 2 pending migrations:
  20130826173639 CreateSingularModelNamesSingularModelNames
  20130826173941 CreateEventsEvents
Run `rake db:migrate` to update your database then try again.

保留中の移行が何を意味するかについてGoogleで検索したところ、誰かが他の誰かに同様の問題を抱えて実行するように言った--traceので、ここに私の試みがありました

jgallardo:rickrockstar juan.gallardo$ rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
rake aborted!
/Users/juan.gallardo/Desktop/myfiles/test-projects/rickrockstar/db/migrate/20130826173639_create_singular_model_names_singular_model_names.refinery_singular_model_names.rb:7: syntax error, unexpected '[', expecting tSTRING_CONTENT or tSTRING_DBEG or tSTRING_DVAR or tSTRING_END
  t.type :[attribute
           ^
/Users/juan.gallardo/Desktop/myfiles/test-projects/rickrockstar/db/migrate/20130826173639_create_singular_model_names_singular_model_names.refinery_singular_model_names.rb:8: syntax error, unexpected ..., expecting tSTRING_CONTENT or tSTRING_DBEG or tSTRING_DVAR or tSTRING_END
  t.string :...]
               ^
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in `require'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in `block in require'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in `require'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.14/lib/active_record/migration.rb:537:in `load_migration'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.14/lib/active_record/migration.rb:533:in `migration'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.14/lib/active_record/migration.rb:528:in `migrate'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.14/lib/active_record/migration.rb:720:in `block (2 levels) in migrate'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.14/lib/active_record/migration.rb:775:in `call'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.14/lib/active_record/migration.rb:775:in `block in ddl_transaction'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.14/lib/active_record/transactions.rb:208:in `transaction'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.14/lib/active_record/migration.rb:775:in `ddl_transaction'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.14/lib/active_record/migration.rb:719:in `block in migrate'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.14/lib/active_record/migration.rb:700:in `each'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.14/lib/active_record/migration.rb:700:in `migrate'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.14/lib/active_record/migration.rb:570:in `up'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.14/lib/active_record/migration.rb:551:in `migrate'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.14/lib/active_record/railties/databases.rake:193:in `block (2 levels) in <top (required)>'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/rake-10.1.0/lib/rake/task.rb:236:in `call'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/rake-10.1.0/lib/rake/task.rb:236:in `block in execute'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/rake-10.1.0/lib/rake/task.rb:231:in `each'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/rake-10.1.0/lib/rake/task.rb:231:in `execute'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/rake-10.1.0/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
/Users/juan.gallardo/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/rake-10.1.0/lib/rake/task.rb:161:in `invoke'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/rake-10.1.0/lib/rake/application.rb:149:in `invoke_task'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/rake-10.1.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/rake-10.1.0/lib/rake/application.rb:106:in `each'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/rake-10.1.0/lib/rake/application.rb:106:in `block in top_level'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/rake-10.1.0/lib/rake/application.rb:115:in `run_with_threads'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/rake-10.1.0/lib/rake/application.rb:100:in `top_level'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/rake-10.1.0/lib/rake/application.rb:78:in `block in run'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/gems/rake-10.1.0/bin/rake:33:in `<top (required)>'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/bin/rake:23:in `load'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/bin/rake:23:in `<main>'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/bin/ruby_noexec_wrapper:14:in `eval'
/Users/juan.gallardo/.rvm/gems/ruby-2.0.0-p195/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => db:migrate
4

2 に答える 2

0

受け入れられた回答で指摘されているように、6.2 の下に示すように、間違ったコードをコピーして貼り付けました。

サンプルコード

結局、プロジェクトを削除して最初からやり直しました。しかし、私は下からコピーして貼り付けます

コピーパスタ

その後、すべてがうまくいきました。

于 2013-08-28T17:50:59.580 に答える