Skip to content

Instantly share code, notes, and snippets.

@jrallison
Created December 15, 2011 22:31
Show Gist options
  • Save jrallison/1483238 to your computer and use it in GitHub Desktop.
Save jrallison/1483238 to your computer and use it in GitHub Desktop.
Admin assistant and Rails 3.0.10 issue.
diff --git a/Gemfile b/Gemfile
index 861f72a..e63813d 100644
--- a/Gemfile
+++ b/Gemfile
@@ -5,7 +5,8 @@ gem 'rails', '3.0.10'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
-gem 'sqlite3'
+gem 'mysql'
+gem 'admin_assistant'
# Use unicorn as the web server
# gem 'unicorn'
diff --git a/app/controllers/admin/blog_posts_controller.rb b/app/controllers/admin/blog_posts_controller.rb
new file mode 100644
index 0000000..f3588b2
--- /dev/null
+++ b/app/controllers/admin/blog_posts_controller.rb
@@ -0,0 +1,6 @@
+class Admin::BlogPostsController < ApplicationController
+ layout 'admin'
+
+ admin_assistant_for BlogPost do |admin|
+ end
+end
diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb
new file mode 100644
index 0000000..e5791ab
--- /dev/null
+++ b/app/models/blog_post.rb
@@ -0,0 +1,2 @@
+class BlogPost < ActiveRecord::Base
+end
diff --git a/config/database.yml b/config/database.yml
index 90d87cc..16c7cf9 100644
--- a/config/database.yml
+++ b/config/database.yml
@@ -1,8 +1,8 @@
# SQLite version 3.x
# gem install sqlite3
development:
- adapter: sqlite3
- database: db/development.sqlite3
+ adapter: mysql
+ database: admin_assistant_dev
pool: 5
timeout: 5000
@@ -10,13 +10,7 @@ development:
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
- adapter: sqlite3
- database: db/test.sqlite3
- pool: 5
- timeout: 5000
-
-production:
- adapter: sqlite3
- database: db/production.sqlite3
+ adapter: mysql
+ database: admin_assistant_test
pool: 5
timeout: 5000
diff --git a/db/migrate/20111215220159_create_blog_posts.rb b/db/migrate/20111215220159_create_blog_posts.rb
new file mode 100644
index 0000000..71fc2a1
--- /dev/null
+++ b/db/migrate/20111215220159_create_blog_posts.rb
@@ -0,0 +1,12 @@
+class CreateBlogPosts < ActiveRecord::Migration
+ def self.up
+ create_table :blog_posts do |t|
+ t.string :title
+ t.text :body
+ end
+ end
+
+ def self.down
+ drop_table :blog_posts
+ end
+end
@jrallison
Copy link
Author

Result of rake db:migrate:

$ rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
Table 'admin_assistant_dev.blog_posts' doesn't exist
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/activerecord-3.0.10/lib/active_record/connection_adapters/mysql_adapter.rb:287:in `query'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/activerecord-3.0.10/lib/active_record/connection_adapters/mysql_adapter.rb:287:in `execute'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/activerecord-3.0.10/lib/active_record/connection_adapters/mysql_adapter.rb:452:in `columns'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/activerecord-3.0.10/lib/active_record/base.rb:685:in `columns'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/admin_assistant-2.2.3/lib/admin_assistant/model.rb:67:in `searchable_columns'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/admin_assistant-2.2.3/lib/admin_assistant.rb:61:in `initialize'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/admin_assistant-2.2.3/lib/admin_assistant.rb:209:in `new'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/admin_assistant-2.2.3/lib/admin_assistant.rb:209:in `admin_assistant_for'
/web/admin_assist_test/app/controllers/admin/blog_posts_controller.rb:4
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `require'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `require'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:225:in `load_dependency'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:593:in `new_constants_in'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:225:in `load_dependency'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `require'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/admin_assistant-2.2.3/config/routes.rb:8
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/admin_assistant-2.2.3/config/routes.rb:5:in `each'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/admin_assistant-2.2.3/config/routes.rb:5
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:235:in `load'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:235:in `load'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:225:in `load_dependency'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:593:in `new_constants_in'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:225:in `load_dependency'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:235:in `load'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/railties-3.0.10/lib/rails/application.rb:127:in `reload_routes!'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/railties-3.0.10/lib/rails/application.rb:127:in `each'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/railties-3.0.10/lib/rails/application.rb:127:in `reload_routes!'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/railties-3.0.10/lib/rails/application.rb:120:in `routes_reloader'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/activesupport-3.0.10/lib/active_support/file_update_checker.rb:32:in `call'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/activesupport-3.0.10/lib/active_support/file_update_checker.rb:32:in `execute_if_updated'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/railties-3.0.10/lib/rails/application/finisher.rb:51
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/railties-3.0.10/lib/rails/application/finisher.rb:52:in `call'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/railties-3.0.10/lib/rails/application/finisher.rb:52
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/railties-3.0.10/lib/rails/initializable.rb:25:in `instance_exec'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/railties-3.0.10/lib/rails/initializable.rb:25:in `run'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/railties-3.0.10/lib/rails/initializable.rb:50:in `run_initializers'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/railties-3.0.10/lib/rails/initializable.rb:49:in `each'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/railties-3.0.10/lib/rails/initializable.rb:49:in `run_initializers'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/railties-3.0.10/lib/rails/application.rb:134:in `initialize!'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/railties-3.0.10/lib/rails/application.rb:77:in `send'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/railties-3.0.10/lib/rails/application.rb:77:in `method_missing'
/web/admin_assist_test/config/environment.rb:5
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `require'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `require'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:225:in `load_dependency'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:593:in `new_constants_in'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:225:in `load_dependency'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/activesupport-3.0.10/lib/active_support/dependencies.rb:239:in `require'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/railties-3.0.10/lib/rails/application.rb:103:in `require_environment!'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/railties-3.0.10/lib/rails/application.rb:218:in `initialize_tasks'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `execute'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
/Users/jrallison/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/rake-0.9.2.2/lib/rake/task.rb:176:in `invoke_prerequisites'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `each'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/rake-0.9.2.2/lib/rake/task.rb:157:in `invoke_with_call_chain'
/Users/jrallison/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `run'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/gems/rake-0.9.2.2/bin/rake:33
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/bin/rake:19:in `load'
/Users/jrallison/.rvm/gems/ree-1.8.7-2010.02/bin/rake:19
Tasks: TOP => db:migrate => environment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment