rake db:migrate returns with error - ruby

I ran rake db:migrate and I came across this error in terminal
SQLite3::SQLException: no such table: admin_users: ALTER TABLE "admin_users" ADD "username" varchar(25)/Users/IsaiahxD/.rvm/gems/ruby-2.2.1/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `initialize'
/Users/IsaiahxD/.rvm/gems/ruby-2.2.1/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `new'
/Users/IsaiahxD/.rvm/gems/ruby-2.2.1/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `prepare'
/Users/IsaiahxD/.rvm/gems/ruby-2.2.1/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:134:in `execute'
/Users/IsaiahxD/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.3/lib/active_record/connection_adapters/sqlite3_adapter.rb:329:in `block in execute'
/Users/IsaiahxD/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract_adapter.rb:473:in `block in log'
I looked into my alter_user.rb file class AlterUsers < ActiveRecord::Migration
this is the file 20150825065823_alter_users.rb
def up
rename_table("users", "admin_users.broken")
add_column("admin_users", "username", :string, :limit => 25, :after => "email" )
change_column("admin_users", "email", :string, :limit => 100)
rename_column("admin_users", "broken", "hashed_password")
puts "*** Adding an index is next ***"
add_index("admin_users", "username")
end
def down
remove_index("admin_users", "username")
rename_column("admin_users", "hashed_password", "password")
change_column("admin_users", "email", :string, :default => "" , :null => false)
remove_column("admin_users", "username")
rename_table("admin_users", "users")
end

In your #up method, you're adding columns to admin_users but you haven't defined that table yet.
Instead of:
rename_table("users", "admin_users.broken")
try:
rename_table("users", "admin_users")

Related

Error message when running Rake command in Rails app

I'm trying to create posts in my Rails app by pulling data from a CSV file.
When I try to run a Rake command, I get the error message below. What's wrong with this code?
SEED.RAKE FILE
require 'csv'
namespace :csv do
desc "Import CSV Data for Michelin Star Restaurants"
task :post => :environment do
csv_file_path = 'db/data.csv'
CSV.foreach(csv_file_path) do |row|
Post.create({
:name => row[1],
:address => row[2],
:city => row[3],
:michelin_status => row[4],
:website => row[5],
:phone => row[6],
:longitude => row[7],
:latitude => row[8],
:inthenews => row[9],
:google_reviews => row[10],
})
end
end
end
ERROR MESSAGE FROM CONSOLE
Faisals-Air:dinner fkhalid2008$ rake csv:post
rake aborted!
ArgumentError: invalid byte sequence in UTF-8
/Users/fkhalid2008/dinner/lib/tasks/seed.rake:11:in `block (2 levels) in <top (required)>'
/Users/fkhalid2008/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `eval'
/Users/fkhalid2008/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => csv:post
(See full trace by running task with --trace)
DB MIGRATE FILE
class CreatePosts < ActiveRecord::Migration
def change
create_table :posts do |t|
t.string :name
t.string :inthenews
t.string :michelin_status
t.string :google_reviews
t.string :address
t.string :city
t.string :website
t.integer :phone
t.integer :longitude
t.integer :latitude
t.timestamps null: false
end
end
end
CSV FILE SCREENSHOT
This is because somewhere in your file there are some invalid bytes.
To avoid this issue, you can use scrub method like this:
CSV.foreach(csv_file_path) do |row|
Post.create({
:name => row[1].scrub,
:address => row[2].scrub,
:city => row[3].scrub,
:michelin_status => row[4].scrub,
:website => row[5].scrub,
:phone => row[6].scrub,
:longitude => row[7].scrub,
:latitude => row[8].scrub,
:inthenews => row[9].scrub,
:google_reviews => row[10].scrub,
})
end
Update
Try to specify the encoding type when you read the CSV file like this:
CSV.foreach(csv_file_path, "r:ISO-8859-1") do |row|
. . .
. . .
end
You can simply convert the original csv file to utf8 with nkf.
$ nkf -w --overwrite db/data.csv

How to get rid of sequel error in sequel?

here's my code:
init file:
require 'sequel'
DB = Sequel.connect('sqlite://data.db')
DB.drop_table?(:restaurants)
DB.create_table :restaurants do
primary_key :id
String :name
end
DB.drop_table?(:category)
DB.create_table :category do
primary_key :id
String :name
end
DB.drop_table?(:items)
DB.create_table :items do
primary_key :id
foreign_key :restaurant_id
foreign_key :category_name
String :name
Float :price
end
require_relative './restaurant'
require_relative './categories'
require_relative './item'
app file:
require_relative './models/init
p = Category.create(:name => 'Pizza')
c = Category.create(:name => 'Calazone')
pa = Category.create(:name => 'Pasta')
s = Category.create(:name => 'Salad')
d = Category.create(:name => 'Dessert')
dr = Category.create(:name => 'Drink')
si = Category.create(:name => 'Side')`
But I am getting this error:
/home/ben/.rvm/gems/ruby-1.9.3-p385/gems/sequel-3.45.0/lib/sequel/model/base.rb:1780:in `block in set_restricted': method name= doesn't exist (Sequel::Error)
from /home/ben/.rvm/gems/ruby-1.9.3-p385/gems/sequel-3.45.0/lib/sequel/model/base.rb:1767:in `each'
from /home/ben/.rvm/gems/ruby-1.9.3-p385/gems/sequel-3.45.0/lib/sequel/model/base.rb:1767:in `set_restricted'
from /home/ben/.rvm/gems/ruby-1.9.3-p385/gems/sequel-3.45.0/lib/sequel/model/base.rb:1278:in `set'
from /home/ben/.rvm/gems/ruby-1.9.3-p385/gems/sequel-3.45.0/lib/sequel/model/base.rb:1736:in `initialize_set'
from /home/ben/.rvm/gems/ruby-1.9.3-p385/gems/sequel-3.45.0/lib/sequel/model/base.rb:920:in `initialize'
from /home/ben/.rvm/gems/ruby-1.9.3-p385/gems/sequel-3.45.0/lib/sequel/model/base.rb:156:in `new'
from /home/ben/.rvm/gems/ruby-1.9.3-p385/gems/sequel-3.45.0/lib/sequel/model/base.rb:156:in `create'
from app.rb:4:in `<main>'"
Help Please.
Thanks
You don't post your Category model, but I'm guessing it's not actually looking at the category table (probably the categories table). You either want to rename your database table to categories or tell your Category model to use the category table. If that's not it, you probably want to post your model code.

friendly_id 4.0.8 with rails 3.0.1 rails generate friendly_id not working?

I am using friendly_id 4.0.8 with rails 3.0.1. I want to use the history feature.
When I type the command rails generate friendly_id, it fails with the following error message:
[WARNING] Could not load generator "generators/friendly_id_generator". Error: ActiveRecord is not missing constant Migration!.
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:479:in `load_missing_constant'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:183:in `rake_original_const_missing'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:181:in `each'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:181:in `rake_original_const_missing'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2503:in `const_missing'
/usr/lib/ruby/gems/1.8/gems/friendly_id-4.0.8/lib/generators/friendly_id_generator.rb:8
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:239:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:239:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:225:in `load_dependency'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:591:in `new_constants_in'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:225:in `load_dependency'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.1/lib/active_support/dependencies.
Is there some different syntax to make it work ?
I have got it working currently by manually generating a migration script with
rails generate migration create_friendly_id_slugs
Then replace the contents of the migration script with that from gems/friendly_id-4.0.8/lib/friendly_id/migration.rb as follows:
class CreateFriendlyIdSlugs < ActiveRecord::Migration
def self.up
create_table :friendly_id_slugs do |t|
t.string :slug, :null => false
t.integer :sluggable_id, :null => false
t.string :sluggable_type, :limit => 40
t.datetime :created_at
end
add_index :friendly_id_slugs, :sluggable_id
add_index :friendly_id_slugs, [:slug, :sluggable_type], :unique => true
add_index :friendly_id_slugs, :sluggable_type
end
def self.down
drop_table :friendly_id_slugs
end
end
Then run rake db:migrate

How to migrate correctly with sequel on Access 2007

When I migrate my application to Access 2007 with sequel library of Ruby. I get the errors as follows. Does anybody know how to migrate correctly? Thanks.
C:\ContractManagement>rackup
C:/Ruby192/lib/ruby/gems/1.9.1/gems/sequel-3.23.0/lib/sequel/adapters/ado.rb:63:
in `method_missing': WIN32OLERuntimeError: (in OLE method `Execute': ) (Sequel::
DatabaseError)
OLE error code:80040E14 in Microsoft Office Access Database Engine
Syntax error (missing operator) in query expression 'LIMIT 1 1'.
HRESULT error code:0x80020009
Exception occurred.
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sequel-3.23.0/lib/sequel/adapte
rs/ado.rb:63:in `block (2 levels) in execute'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sequel-3.23.0/lib/sequel/databa
se/logging.rb:28:in `log_yield'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sequel-3.23.0/lib/sequel/adapte
rs/ado.rb:63:in `block in execute'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sequel-3.23.0/lib/sequel/connec
tion_pool/threaded.rb:84:in `hold'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sequel-3.23.0/lib/sequel/databa
se/connecting.rb:226:in `synchronize'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sequel-3.23.0/lib/sequel/adapte
rs/ado.rb:61:in `execute'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sequel-3.23.0/lib/sequel/datase
t/actions.rb:541:in `execute'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sequel-3.23.0/lib/sequel/adapte
rs/ado.rb:97:in `fetch_rows'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sequel-3.23.0/lib/sequel/datase
t/actions.rb:123:in `each'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sequel-3.23.0/lib/sequel/datase
t/actions.rb:449:in `single_record'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sequel-3.23.0/lib/sequel/datase
t/actions.rb:457:in `single_value'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sequel-3.23.0/lib/sequel/datase
t/actions.rb:200:in `get'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sequel-3.23.0/lib/sequel/datase
t/actions.rb:133:in `empty?'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sequel-3.23.0/lib/sequel/extens
ions/migration.rb:499:in `schema_dataset'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sequel-3.23.0/lib/sequel/extens
ions/migration.rb:381:in `initialize'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sequel-3.23.0/lib/sequel/extens
ions/migration.rb:422:in `initialize'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sequel-3.23.0/lib/sequel/extens
ions/migration.rb:332:in `new'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sequel-3.23.0/lib/sequel/extens
ions/migration.rb:332:in `run'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sequel-3.23.0/lib/sequel/extens
ions/migration.rb:316:in `apply'
from C:/ContractManagement/config.ru:12:in `block in <main>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.3.0/lib/rack/builder.rb:
51:in `instance_eval'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.3.0/lib/rack/builder.rb:
51:in `initialize'
from C:/ContractManagement/config.ru:1:in `new'
from C:/ContractManagement/config.ru:1:in `<main>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.3.0/lib/rack/builder.rb:
40:in `eval'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.3.0/lib/rack/builder.rb:
40:in `parse_file'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.3.0/lib/rack/server.rb:2
00:in `app'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.3.0/lib/rack/server.rb:3
01:in `wrapped_app'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.3.0/lib/rack/server.rb:2
52:in `start'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.3.0/lib/rack/server.rb:1
37:in `start'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.3.0/bin/rackup:4:in `<to
p (required)>'
from C:/Ruby192/bin/rackup:19:in `load'
from C:/Ruby192/bin/rackup:19:in `<main>'
Here is the connection configuration.
DB = Sequel.ado(:conn_string=>'Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\ContractManagement1.accdb')
And here is the migration steps. All are passed on PostgreSQL 8.4.
Sequel.migration do
up do
create_table :people do
primary_key :id
String :name, :size => 20, :unique => true, :null => false
String :password, :size => 30, :null => false
String :role, :size => 20, :null => false
end
end
down do
drop_table :people
end
end
Sequel.migration do
up do
create_table :currencies do
primary_key :id
String :name, :size => 10, :null => false
end
end
down do
drop_table :currencies
end
end
Sequel.migration do
up do
create_table :statuses do
primary_key :id
String :name, :size => 10, :null => false
end
end
down do
drop_table :statuses
end
end
# encoding: utf-8
Sequel.migration do
up do
create_table :contracts do
primary_key :id
String :contract_id, :size => 36, :unique => true, :null => false
String :content, :size => 150
String :supplier, :size => 30
Date :created_on
Date :expired_on
BigDecimal :amount, :size => [10, 2], :null => false
Fixnum :debt_days
Fixnum :guarantee_period
String :order_id, :size => 50 # 订单号
String :supplier_contract_id, :size => 36
String :operator, :size => 30
foreign_key :currency_id, :currencies, :on_delete => :cascade, :on_update => :cascade, :null => false
foreign_key :status_id, :statuses, :on_delete => :cascade, :on_update => :cascade, :null => false
constraint(:min_amount) { amount >= 0.01 }
end
end
down do
drop_table :contracts
end
end
# encoding: utf-8
Sequel.migration do
up do
self[:currencies].insert(:name => "人民币")
self[:currencies].insert(:name => "欧元")
self[:currencies].insert(:name => "美元")
end
down do
self[:currencies].delete
end
end
# encoding: utf-8
Sequel.migration do
up do
self[:statuses].insert(:name => "执行中")
self[:statuses].insert(:name => "关闭")
self[:statuses].insert(:name => "作废")
end
down do
self[:statuses].delete
end
end
# encoding: utf-8
Sequel.migration do
up do
create_table :payments do
primary_key :id
BigDecimal :prepayment, :size => [10, 2], :default => 0 # 预付金额(元)
BigDecimal :offset_prepayment, :size => [10, 2], :default => 0 # 冲预付
BigDecimal :guarantee_price, :size => [10, 2], :default => 0 # 质保金
BigDecimal :request_amount, :size => [10, 2], :default => 0 # 申请付款额
foreign_key :contract_id, :contracts, :on_delete => :cascade, :on_update => :cascade
foreign_key :person_id, :people, :on_delete => :cascade, :on_update => :cascade
constraint(:offset_prepayment_is_not_greater_than_prepayment) { prepayment >= offset_prepayment } # offset_prepayment不能大于prepayment
end
end
down do
drop_table :payments
end
end
Sequel.migration do
up do
{"admin" => "Admin", "contract" => "ContractOperator", "payment" => "PaymentOperator", "report" => "ReportReviewer"}.each do |n, r|
self[:people].insert(:name => n, :password => n, :role => r)
end
self[:people].insert(:name => "payment1", :password => "payment1", :role => "PaymentOperator")
end
down do
self[:people].delete
end
end
I think you get this error message ...
OLE error code:80040E14 in Microsoft Office Access Database Engine
Syntax error (missing operator) in query expression 'LIMIT 1 1'.
... because Access SQL doesn't support LIMIT. See this reply to a related Stack Overflow question.
See whether you can use Access SQL TOP N as a substitute for LIMIT N.
SELECT TOP 1 m.id, m.paid_in_full, m.date_field
FROM MyTable AS m
ORDER BY m.date_field DESC;
This is fixed in the master branch of Sequel, version 3.24.0 (which will be released next week) will have the bugfix.

Strange problem with factory girl

I have a model
# == Schema Information
#
# Table name: posts
#
# id :integer not null, primary key
# name :string(255)
# title :string(255)
# content :text
# created_at :datetime
# updated_at :datetime
# abstract :text
# category_id :integer
# finalversion :boolean default(FALSE)
# published_date :date
#
class Post < ActiveRecord::Base
has_many :tags
belongs_to :category
validates :published_date, :presence => true
default_scope :order => 'created_at DESC'
accepts_nested_attributes_for :tags, :allow_destroy => :true,
:reject_if => proc { |attrs| attrs.all? { |k, v| v.blank? } }
def prev_post
self.class.first(:conditions => ["id < ?", id], :order => "id desc")
end
def next_post
self.class.first(:conditions => ["id > ?", id], :order => "id asc")
end
def seo_title
title.gsub(/\s+/,'_')
end
end
and a factory
FactoryGirl.define do
factory :post do
published_date Date.today
association :category, :factory => :category
title Forgery::LoremIpsum.words
name Forgery::LoremIpsum.word
content Forgery::LoremIpsum.words(100, :random => 250)
abstract Forgery::LoremIpsum.words(100, :random => 50)
finalversion true
end
end
and in the rails console I have no problem doing
FactoryGirl.create :post
to get a valid object and am able to access the *published_date* attribute. However in my spec
require 'spec_helper'
(1..5).map do |i|
title = "a title\t#{i}"
escape_title = "a_title_#{i}"
perma_link = "/posts/#{i}/title/#{escape_title}"
describe "A post with title '#{title}'" do
before do
#post = FactoryGirl.create :post, :id=>i, :title => title
visit '/posts'
end
it "should appear in all links with permalink #{perma_link}" do
within "section.post_#{#post.id}" do
page.should have_xpath(%Q%.//h1/a[#href="#{perma_link}"]%)
within "div.teaser" do
page.should have_xpath(%Q%.//a[#href="#{perma_link}"]%)
end
end
end
end
end
I get the backtrace error
5) A post with title 'a title 5' should appear in all links with permalink /posts/5/title/a_title_5
Failure/Error: #post = FactoryGirl.create :post, :id=>i, :title => title
NoMethodError:
undefined method `published_date=' for #<Post:0x000001047266b8>
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/activemodel-3.0.5/lib/active_model/attribute_methods.rb:364:in `method_missing'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/activerecord-3.0.5/lib/active_record/attribute_methods.rb:46:in `method_missing'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/bundler/gems/factory_girl-4f5f5df39a1b/lib/factory_girl/proxy/build.rb:13:in `set'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/bundler/gems/factory_girl-4f5f5df39a1b/lib/factory_girl/attribute/static.rb:12:in `add_to'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/bundler/gems/factory_girl-4f5f5df39a1b/lib/factory_girl/factory.rb:93:in `block in run'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/bundler/gems/factory_girl-4f5f5df39a1b/lib/factory_girl/factory.rb:91:in `each'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/bundler/gems/factory_girl-4f5f5df39a1b/lib/factory_girl/factory.rb:91:in `run'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/bundler/gems/factory_girl-4f5f5df39a1b/lib/factory_girl/syntax/methods.rb:54:in `create'
# ./spec/integration/posts_permalinks_spec.rb:12:in `block (3 levels) in <top (required)>'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/hooks.rb:29:in `instance_eval'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/hooks.rb:29:in `run_in'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/hooks.rb:64:in `block in run_all'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/hooks.rb:64:in `each'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/hooks.rb:64:in `run_all'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/hooks.rb:110:in `run_hook'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/example_group.rb:191:in `block in eval_before_eachs'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/example_group.rb:191:in `each'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/example_group.rb:191:in `eval_before_eachs'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/example.rb:144:in `run_before_each'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/example.rb:48:in `block (2 levels) in run'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/example.rb:106:in `with_around_hooks'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/example.rb:46:in `block in run'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/example.rb:99:in `block in with_pending_capture'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/example.rb:98:in `catch'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/example.rb:98:in `with_pending_capture'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/example.rb:45:in `run'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/example_group.rb:262:in `block in run_examples'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/example_group.rb:258:in `map'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/example_group.rb:258:in `run_examples'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/example_group.rb:232:in `run'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/command_line.rb:27:in `block (2 levels) in run'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/command_line.rb:27:in `map'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/command_line.rb:27:in `block in run'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/reporter.rb:12:in `report'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/command_line.rb:24:in `run'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:55:in `run_in_process'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:46:in `run'
# /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180#ingd/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:10:in `block in autorun'
I'm totally stumped on it. Any ideas
Brad
Did you run rake db:test:prepare? It looks to me like your Post model has published_date, but your Factory is saying it doesn't exist. Not running this rake task would be the major thing that would cause this.

Resources