Doing the tutorial on using the Refinery CMS at http://refinerycms.com/guides/getting-started#rails-application-templates and at the point of
6 Extending Refinery with your first Engine
which says to run
rails generate refinery:engine singular_model_name attribute:type [attribute:type ...]
then to run
rails generate refinery:engine event title:string date:datetime photo:image blurb:text
Afterwards I went through the rest but rake db:migrate
did not seem to work because when I tried to run rake db:seed
I got an error that I needed to run rake db:migrate
. I tried running the app locally and got this
This was in the terminal somewhere and looks relevant
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>
I also got this error about authors, but the tutorial had not mentioned it
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
So I went through the process again
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!
This time I clearly saw the rake aborted
but tried this anyways
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.
I searched on Google about what pending migrations meant, and I saw that someone told someone else with a similar problem to run with --trace
so here was my attempt
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
Tutorials work best if you read and think about what they are saying rather than just copying & pasting parts of them into your Terminal.
In this case, the example you copied and pasted was:
You successfully substituted this for correct syntax when you generated the events extension, though, so no problem with that one.
Delete the migration titled CreateSingularModelNamesSingularModelNames and its entire corresponding extension. You copy pasted example syntax which doesn't result in valid Ruby.