NoMethodError: undefined method `key_columns' for #<Class:0x00000007863dd0> - ruby-on-rails

I'm new at rails and also cequel. I have existing model witch was genearted on Postgres and now i'm trying to migrate it to the Cassandra.
1. I would just like to migrate one of my model and other i would like to leave on Postgres. Is this possible?
My models:
class TripPoint
include Cequel::Record
belongs_to :trip
key :device_created_at, :timestamp
key :trip_points_id, :timeuuid, auto: true
column :rssi, :int
....
end
class Trip < ActiveRecord::Base
has_many :trip_points
end
When i try to run: rake cequel:migrate
I'm getting the error:
rake aborted!
NoMethodError: undefined method `key_columns' for #<Class:0x00000007863dd0>
/home/zmagajna/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.10/lib/active_record/dynamic_matchers.rb:26:in `method_missing'
/home/zmagajna/.rvm/gems/ruby-2.1.2/gems/cequel-1.7.0/lib/cequel/record/associations.rb:117:in `belongs_to'
/home/zmagajna/Ruby/ULU/ulu-rails/app/models/trip_point.rb:10:in `<class:TripPoint>'
/home/zmagajna/Ruby/ULU/ulu-rails/app/models/trip_point.rb:1:in `<top (required)>'
/home/zmagajna/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.10/lib/active_support/dependencies.rb:443:in `load'
/home/zmagajna/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.10/lib/active_support/dependencies.rb:443:in `block in load_file'
/home/zmagajna/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.10/lib/active_support/dependencies.rb:633:in `new_constants_in'
/home/zmagajna/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.10/lib/active_support/dependencies.rb:442:in `load_file'
/home/zmagajna/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.10/lib/active_support/dependencies.rb:342:in `require_or_load'
/home/zmagajna/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.10/lib/active_support/dependencies.rb:307:in `depend_on'
/home/zmagajna/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.10/lib/active_support/dependencies.rb:225:in `require_dependency'
/home/zmagajna/.rvm/gems/ruby-2.1.2/gems/cequel-1.7.0/lib/cequel/record/tasks.rb:61:in `block in migrate'
/home/zmagajna/.rvm/gems/ruby-2.1.2/gems/cequel-1.7.0/lib/cequel/record/tasks.rb:55:in `each'
/home/zmagajna/.rvm/gems/ruby-2.1.2/gems/cequel-1.7.0/lib/cequel/record/tasks.rb:55:in `migrate'
/home/zmagajna/.rvm/gems/ruby-2.1.2/gems/cequel-1.7.0/lib/cequel/record/tasks.rb:21:in `block (2 levels) in <top (required)>'
/home/zmagajna/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `eval'
/home/zmagajna/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => cequel:migrate
(See full trace by running task with --trace)
My environment:
ruby 2.1.2p95
Rails 4.1.10
cequel (= 1.7.0)

Related

error when use "rake db:migrate" on Ubuntu 16.04.5 LTS

I'm use "rake db:migrate" and getting this error message:
Pls help me to fix that:
# rake db:migrate rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
Directly inheriting from ActiveRecord::Migration is not supported. Please specify the Rails release the migration was written for:
class CreateUsers < ActiveRecord::Migration[4.2]
/var/lib/gems/2.3.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:528:in `inherited'
/root/genieacs-gui/db/migrate/20160202145722_create_users.rb:1:in `<top (required)>'
/var/lib/gems/2.3.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
/var/lib/gems/2.3.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
/var/lib/gems/2.3.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
/var/lib/gems/2.3.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
/var/lib/gems/2.3.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:986:in `load_migration'
/var/lib/gems/2.3.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:982:in `migration'
/var/lib/gems/2.3.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:977:in `disable_ddl_transaction'
/var/lib/gems/2.3.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1350:in `use_transaction?'
/var/lib/gems/2.3.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1342:in `ddl_transaction'
/var/lib/gems/2.3.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1291:in `execute_migration_in_transaction'
/var/lib/gems/2.3.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1263:in `block in migrate_without_lock'
/var/lib/gems/2.3.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1262:in `each'
/var/lib/gems/2.3.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1262:in `migrate_without_lock'
/var/lib/gems/2.3.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1212:in `migrate'
/var/lib/gems/2.3.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1036:in `up'
/var/lib/gems/2.3.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1011:in `migrate'
/var/lib/gems/2.3.0/gems/activerecord-5.2.1/lib/active_record/tasks/database_tasks.rb:172:in `migrate'
/var/lib/gems/2.3.0/gems/activerecord-5.2.1/lib/active_record/railties/databases.rake:60:in `block (2 levels) in <top (required)>'
/var/lib/gems/2.3.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
#...
Tasks: TOP => db:migrate
Your migrations in db/migrate directory should all inherit from ActiveRecord::Migration[5.2], not ActiveRecord::Migration

Uninitialized constant after rake db migration

I wanted to add a table called measurement_error_categories using rake db:migrate.
I created a migration file with bundle exec rake db:create_migration NAME=create_measurement_error_category_table
Now I get following error after running bundle exec rake db:migrate
== 20170620084816 CreateMeasurementErrorCategoryTable: migrating ==============
rake aborted!
An error has occurred, this and all later migrations canceled:
uninitialized constant CreateMeasurementErrorCategoryTable::MeasurementErrorCategory
/Users/ndinatale/leanlogic-qa-prototype/server/db/migrate/20170620084816_create_measurement_error_category_table.rb:3:in `change'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/migration.rb:602:in `exec_migration'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/migration.rb:586:in `block (2 levels) in migrate'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/migration.rb:585:in `block in migrate'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/migration.rb:584:in `migrate'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/migration.rb:759:in `migrate'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/migration.rb:1044:in `block in ddl_transaction'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `block in transaction'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/connection_adapters/abstract/database_statements.rb:209:in `within_new_transaction'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `transaction'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/transactions.rb:208:in `transaction'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/migration.rb:1044:in `ddl_transaction'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/migration.rb:997:in `execute_migration_in_transaction'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/migration.rb:959:in `block in migrate'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/migration.rb:955:in `each'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/migration.rb:955:in `migrate'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/migration.rb:814:in `up'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/migration.rb:792:in `migrate'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
/Library/Ruby/Gems/2.0.0/gems/bundler-1.14.3/lib/bundler/cli/exec.rb:74:in `load'
/Library/Ruby/Gems/2.0.0/gems/bundler-1.14.3/lib/bundler/cli/exec.rb:74:in `kernel_load'
/Library/Ruby/Gems/2.0.0/gems/bundler-1.14.3/lib/bundler/cli/exec.rb:27:in `run'
/Library/Ruby/Gems/2.0.0/gems/bundler-1.14.3/lib/bundler/cli.rb:335:in `exec'
/Library/Ruby/Gems/2.0.0/gems/bundler-1.14.3/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/Library/Ruby/Gems/2.0.0/gems/bundler-1.14.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/Library/Ruby/Gems/2.0.0/gems/bundler-1.14.3/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
/Library/Ruby/Gems/2.0.0/gems/bundler-1.14.3/lib/bundler/cli.rb:20:in `dispatch'
/Library/Ruby/Gems/2.0.0/gems/bundler-1.14.3/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
/Library/Ruby/Gems/2.0.0/gems/bundler-1.14.3/lib/bundler/cli.rb:11:in `start'
/Library/Ruby/Gems/2.0.0/gems/bundler-1.14.3/exe/bundle:32:in `block in <top (required)>'
/Library/Ruby/Gems/2.0.0/gems/bundler-1.14.3/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
/Library/Ruby/Gems/2.0.0/gems/bundler-1.14.3/exe/bundle:24:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
20170620084816_create_measurement_error_category_table.rb:
class CreateMeasurementErrorCategoryTable < ActiveRecord::Migration
def change
MeasurementErrorCategory.create_table(self, :measurementerrorcategories)
end
end
measurement_error_category.rb:
class MeasurementErrorCategory < ActiveRecord::Base
include ModelBase
include Ordering
# -----
# Table setup
# -----
before_validation { complete_languageblock(false, :name) }
validates :name, language: { complete: :all, minlength: 3 }
# serialize json object (value) as newline delimited string in the database
serialize :name
augment_class_usertag
def self.create_table(m,tn)
m.create_table tn do |t|
t.string :name
t.integer :seqnum
augment_table_usertag t
end
end
end
What have I done wrong?
Okay I found out. In 20170620084816_create_measurement_error_category_table.rb I changed
class CreateMeasurementErrorCategoryTable < ActiveRecord::Migration
def change
MeasurementErrorCategory.create_table(self, :measurementerrorcategories)
end
end
to
class CreateMeasurementErrorCategoryTable < ActiveRecord::Migration
def create
MeasurementErrorCategory.create_table(self, :measurementerrorcategories)
end
end
So I changed the method name from change to create.

Rake DB not working with Paperclip (ruby 2.4.0p0 and Rails 5.1.0)

I am using Paperclip to create a Pinterest clone, and I'm trying to rake my migration file but I got an error:
I was able to run the generate cmd:
pinterested-app git:(master) ✗ rails generate paperclip user image
Running via Spring preloader in process 88926
create db/migrate/20170511010912_add_attachment_image_to_users.rb
But when I ran tried to rake the db I got the following:
➜ pinterested-app git:(master) ✗ rake db:migrate
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
Directly inheriting from ActiveRecord::Migration is not supported. Please specify the Rails release the migration was written for:
class AddAttachmentImageToUsers < ActiveRecord::Migration[4.2]
/Users/rthomas/.rvm/gems/ruby-2.4.0/gems/activerecord-5.1.0/lib/active_record/migration.rb:525:in `inherited'
/Users/rthomas/Dropbox/rails-dev/pinterested-app/db/migrate/20170511010912_add_attachment_image_to_users.rb:1:in `<top (required)>'
/Users/rthomas/.rvm/gems/ruby-2.4.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in `require'
/Users/rthomas/.rvm/gems/ruby-2.4.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in `block in require'
/Users/rthomas/.rvm/gems/ruby-2.4.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:258:in `load_dependency'
/Users/rthomas/.rvm/gems/ruby-2.4.0/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:292:in `require'
/Users/rthomas/.rvm/gems/ruby-2.4.0/gems/activerecord-5.1.0/lib/active_record/migration.rb:962:in `load_migration'
/Users/rthomas/.rvm/gems/ruby-2.4.0/gems/activerecord-5.1.0/lib/active_record/migration.rb:958:in `migration'
/Users/rthomas/.rvm/gems/ruby-2.4.0/gems/activerecord-5.1.0/lib/active_record/migration.rb:953:in `disable_ddl_transaction'
/Users/rthomas/.rvm/gems/ruby-2.4.0/gems/activerecord-5.1.0/lib/active_record/migration.rb:1305:in `use_transaction?'
/Users/rthomas/.rvm/gems/ruby-2.4.0/gems/activerecord-5.1.0/lib/active_record/migration.rb:1297:in `ddl_transaction'
/Users/rthomas/.rvm/gems/ruby-2.4.0/gems/activerecord-5.1.0/lib/active_record/migration.rb:1229:in `execute_migration_in_transaction'
/Users/rthomas/.rvm/gems/ruby-2.4.0/gems/activerecord-5.1.0/lib/active_record/migration.rb:1201:in `block in migrate_without_lock'
/Users/rthomas/.rvm/gems/ruby-2.4.0/gems/activerecord-5.1.0/lib/active_record/migration.rb:1200:in `each'
/Users/rthomas/.rvm/gems/ruby-2.4.0/gems/activerecord-5.1.0/lib/active_record/migration.rb:1200:in `migrate_without_lock'
/Users/rthomas/.rvm/gems/ruby-2.4.0/gems/activerecord-5.1.0/lib/active_record/migration.rb:1150:in `migrate'
/Users/rthomas/.rvm/gems/ruby-2.4.0/gems/activerecord-5.1.0/lib/active_record/migration.rb:1007:in `up'
/Users/rthomas/.rvm/gems/ruby-2.4.0/gems/activerecord-5.1.0/lib/active_record/migration.rb:985:in `migrate'
/Users/rthomas/.rvm/gems/ruby-2.4.0/gems/activerecord-5.1.0/lib/active_record/tasks/database_tasks.rb:171:in `migrate'
/Users/rthomas/.rvm/gems/ruby-2.4.0/gems/activerecord-5.1.0/lib/active_record/railties/databases.rake:58:in `block (2 levels) in <top (required)>'
/Users/rthomas/.rvm/gems/ruby-2.4.0#global/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
As Rails is asking to specify the Rails release and you're using rails 5.1, try to add [5.1] in the end of ActiveRecord::Migration in your migration file:
class AddAttachmentImageToUsers < ActiveRecord::Migration[5.1]
Then try to run again.

Rails UnknownAttributeError when raking

Within seeds, I have created the following;
post = Post.create(
title: Faker::Lorem.sentence(20),
content: Faker::Lorem.paragraph,
publish: true,
administrator: administrator)
tag = Tag.create(name: Faker::Lorem.words)
post_tag = PostTag.create(post: post, tag: tag)
Then, within terminal i tried to "rake db:reset" and it is not working and showing the following error;
-- initialize_schema_migrations_table()
-> 0.0049s
rake aborted!
ActiveRecord::UnknownAttributeError: unknown attribute 'publish' for Post.
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activerecord- 4.2.5.1/lib/active_record/attribute_assignment.rb:59:in `rescue in _assign_attribute'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activerecord- 4.2.5.1/lib/active_record/attribute_assignment.rb:54:in `_assign_attribute'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5.1/lib/active_record/attribute_assignment.rb:41:in `block in assign_attributes'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5.1/lib/active_record/attribute_assignment.rb:35:in `each'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5.1/lib/active_record/attribute_assignment.rb:35:in `assign_attributes'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5.1/lib/active_record/core.rb:566:in `init_attributes'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5.1/lib/active_record/core.rb:281:in `initialize'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5.1/lib/active_record/inheritance.rb:61:in `new'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5.1/lib/active_record/inheritance.rb:61:in `new'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5.1/lib/active_record/persistence.rb:33:in `create'
/Users/laurenwoodhams/Desktop/PROJECT/RAILS-BLOG/-t/db/seeds.rb:13:in `<top (required)>'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:268:in `load'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:268:in `block in load'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:268:in `load'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5.1/lib/rails/engine.rb:547:in `load_seed'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5.1/lib/active_record/tasks/database_tasks.rb:250:in `load_seed'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5.1/lib/active_record/railties/databases.rake:183:in `block (2 levels) in <top (required)>'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5.1/lib/active_record/railties/databases.rake:142:in `block (2 levels) in <top (required)>'
NoMethodError: undefined method `publish=' for #<Post:0x007f98d0073d00>
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activemodel-4.2.5.1/lib/active_model/attribute_methods.rb:433:in `method_missing'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5.1/lib/active_record/attribute_assignment.rb:54:in `public_send'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5.1/lib/active_record/attribute_assignment.rb:54:in `_assign_attribute'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5.1/lib/active_record/attribute_assignment.rb:41:in `block in assign_attributes'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5.1/lib/active_record/attribute_assignment.rb:35:in `each'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5.1/lib/active_record/attribute_assignment.rb:35:in `assign_attributes'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5.1/lib/active_record/core.rb:566:in `init_attributes'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5.1/lib/active_record/core.rb:281:in `initialize'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5.1/lib/active_record/inheritance.rb:61:in `new'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5.1/lib/active_record/inheritance.rb:61:in `new'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5.1/lib/active_record/persistence.rb:33:in `create'
/Users/laurenwoodhams/Desktop/PROJECT/RAILS-BLOG/-t/db/seeds.rb:13:in `<top (required)>'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:268:in `load'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:268:in `block in load'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:268:in `load'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5.1/lib/rails/engine.rb:547:in `load_seed'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5.1/lib/active_record/tasks/database_tasks.rb:250:in `load_seed'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5.1/lib/active_record/railties/databases.rake:183:in `block (2 levels) in <top (required)>'
/Users/laurenwoodhams/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.5.1/lib/active_record/railties/databases.rake:142:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:setup => db:seed
(See full trace by running task with --trace)
Could you please advise why it may be pushing this error?
Thank you
Then, within terminal i tried to "rake db:reset" . . .
Try running:
rake db:migrate
rake db:reset
Your Post object doesn't have a publish attribute according to your database (for whatever reason).
When you run rake db:reset new migrations do not get, 'migrated.' Instead it loads the schema (that will not include migrations that were not migrated).
More info: https://stackoverflow.com/a/10302357/1026898

Upgrading from rails 2 to rails 3...sqlite3 database no longer working

I have the code for a Rails app that I am updating to Rails 3.0.3 from Rails 2.3.12. I had managed to get the database working when it was still Rails 2.3.12, however since I upgraded Rails it seems to have 'lost' the tables and I can't figure out how to recreate them.
When I do bundle exec rake db:create it says that the test and development databases already exist.
However, when I do bundle exec rake db:migrate it says
rake aborted!
Could not find table 'comments'
All of the migration files are still there, as is the schema, but I don't know how to create the tables?
EDIT
running rake db:migrate --trace gives me this:
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
Could not find table 'comments'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activerecord-3.0.3/lib/active_record/connection_adapters/sqlite_adapter.rb:295:in `table_structure'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activerecord-3.0.3/lib/active_record/connection_adapters/sqlite_adapter.rb:186:in `columns'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activerecord-3.0.3/lib/active_record/base.rb:679:in `columns'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activerecord-3.0.3/lib/active_record/base.rb:692:in `column_names'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activerecord-3.0.3/lib/active_record/relation.rb:367:in `block in method_missing'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activerecord-3.0.3/lib/active_record/relation.rb:122:in `scoping'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activerecord-3.0.3/lib/active_record/relation.rb:367:in `method_missing'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rd_searchlogic-3.0.1/lib/searchlogic/named_scopes/conditions.rb:92:in `condition_details'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rd_searchlogic-3.0.1/lib/searchlogic/named_scopes/conditions.rb:68:in `local_condition?'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rd_searchlogic-3.0.1/lib/searchlogic/named_scopes/conditions.rb:61:in `condition?'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rd_searchlogic-3.0.1/lib/searchlogic/named_scopes/association_conditions.rb:6:in `condition?'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rd_searchlogic-3.0.1/lib/searchlogic/named_scopes/association_ordering.rb:14:in `condition?'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rd_searchlogic-3.0.1/lib/searchlogic/named_scopes/ordering.rb:11:in `condition?'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rd_searchlogic-3.0.1/lib/searchlogic/named_scopes/ordering.rb:31:in `order'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activerecord-3.0.3/lib/active_record/base.rb:441:in `order'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/acts_as_commentable-3.0.1/lib/comment_methods.rb:12:in `included'
/Users/camillavk/Documents/Work/Saild/saild/app/models/comment.rb:6:in `include'
/Users/camillavk/Documents/Work/Saild/saild/app/models/comment.rb:6:in `<class:Comment>'
/Users/camillavk/Documents/Work/Saild/saild/app/models/comment.rb:1:in `<top (required)>'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:454:in `load'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:454:in `block in load_file'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:in `new_constants_in'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:453:in `load_file'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:340:in `require_or_load'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:491:in `load_missing_constant'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:183:in `block in const_missing'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:181:in `each'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:181:in `const_missing'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/aws-s3-0.6.3/lib/aws/s3/extensions.rb:212:in `const_missing_from_s3_library'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.3/lib/active_support/inflector/methods.rb:124:in `block in constantize'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.3/lib/active_support/inflector/methods.rb:123:in `each'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.3/lib/active_support/inflector/methods.rb:123:in `constantize'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.3/lib/active_support/core_ext/string/inflections.rb:43:in `constantize'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activemodel-3.0.3/lib/active_model/observing.rb:182:in `observed_class'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activemodel-3.0.3/lib/active_model/observing.rb:175:in `observed_classes'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activemodel-3.0.3/lib/active_model/observing.rb:195:in `observed_classes'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activemodel-3.0.3/lib/active_model/observing.rb:191:in `initialize'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activerecord-3.0.3/lib/active_record/observer.rb:96:in `initialize'
/Users/camillavk/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/singleton.rb:141:in `new'
/Users/camillavk/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/singleton.rb:141:in `block in instance'
<internal:prelude>:10:in `synchronize'
/Users/camillavk/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/singleton.rb:139:in `instance'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activemodel-3.0.3/lib/active_model/observing.rb:66:in `instantiate_observer'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activemodel-3.0.3/lib/active_model/observing.rb:39:in `block in instantiate_observers'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activemodel-3.0.3/lib/active_model/observing.rb:39:in `each'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activemodel-3.0.3/lib/active_model/observing.rb:39:in `instantiate_observers'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activerecord-3.0.3/lib/active_record/railtie.rb:83:in `block (2 levels) in <class:Railtie>'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.3/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.3/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.3/lib/active_support/lazy_load_hooks.rb:26:in `on_load'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activerecord-3.0.3/lib/active_record/railtie.rb:82:in `block in <class:Railtie>'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.3/lib/active_support/lazy_load_hooks.rb:34:in `call'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.3/lib/active_support/lazy_load_hooks.rb:34:in `execute_hook'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.3/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.3/lib/active_support/lazy_load_hooks.rb:42:in `each'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.3/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.3/lib/rails/application/finisher.rb:46:in `block in <module:Finisher>'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `instance_exec'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `run'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.3/lib/rails/initializable.rb:50:in `block in run_initializers'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `each'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `run_initializers'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.3/lib/rails/application.rb:134:in `initialize!'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.3/lib/rails/application.rb:77:in `method_missing'
/Users/camillavk/Documents/Work/Saild/saild/config/environment.rb:7:in `<top (required)>'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `block in require'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `block in load_dependency'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:in `new_constants_in'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.3/lib/rails/application.rb:103:in `require_environment!'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.3/lib/rails/application.rb:216:in `block in initialize_tasks'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rake-0.8.7/lib/rake.rb:636:in `block in execute'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rake-0.8.7/lib/rake.rb:597:in `block in invoke_with_call_chain'
/Users/camillavk/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rake-0.8.7/lib/rake.rb:607:in `block in invoke_prerequisites'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rake-0.8.7/lib/rake.rb:596:in `block in invoke_with_call_chain'
/Users/camillavk/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rake-0.8.7/lib/rake.rb:2029:in `block (2 levels) in top_level'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rake-0.8.7/lib/rake.rb:2029:in `block in top_level'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/airbrake-4.1.0/lib/airbrake/rake_handler.rb:43:in `standard_exception_handling'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rake-0.8.7/lib/rake.rb:2001:in `block in run'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rake-0.8.7/bin/rake:31:in `<top (required)>'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/bin/rake:23:in `load'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/bin/rake:23:in `<main>'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/bin/ruby_executable_hooks:15:in `eval'
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/bin/ruby_executable_hooks:15:in `<main>'
config/environment.rb:
# Be sure to restart your server when you modify this file
# Load the rails application
require File.expand_path('../application', __FILE__)
#Initialize the rails application
Saild::Application.initialize!
Comment model:
class Comment < ActiveRecord::Base
validates_presence_of :user
validates_presence_of :commentable
#include ActsAsCommentable::Comment
acts_as_commentable
belongs_to :commentable, :polymorphic => true
has_many :feed_items, :as => :object, :dependent => :destroy
default_scope order('created_at ASC')
belongs_to :user
def trip
commentable.trip rescue false
end
end
EDIT
I have removed the ActsAsCommentable that was breaking it before and now it is breaking on line 13 (default_scope order...)

Resources