Last active
December 16, 2015 17:30
-
-
Save petehuang/5471229 to your computer and use it in GitHub Desktop.
Errors: Failure/Error: @appointment = Appointment.new(user_id: user.id, receiver_id: other_user.id, prepday:Date.today, preptime:Time.now, preplocation: "Norris", notes: "NA") ActiveRecord::UnknownAttributeError: unknown attribute: user_id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0000_create_appointments.rb | |
class CreateAppointments < ActiveRecord::Migration | |
def change | |
create_table :appointments do |t| | |
t.integer :user_id | |
t.integer :receiver_id | |
t.date :prepday | |
t.time :preptime | |
t.string :preplocation | |
t.text :notes | |
t.timestamps | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Failures: | |
1) Appointment | |
Failure/Error: @appointment = Appointment.new(user_id: user.id, receiver_id: other_user.id, prepday:Date.today, preptime:Time.now, preplocation: "Norris", notes: "NA") | |
ActiveRecord::UnknownAttributeError: | |
unknown attribute: user_id | |
# ./spec/models/appointment_spec.rb:7:in `new' | |
# ./spec/models/appointment_spec.rb:7:in `block (2 levels) in <top (required)>' | |
2) Appointment | |
Failure/Error: @appointment = Appointment.new(user_id: user.id, receiver_id: other_user.id, prepday:Date.today, preptime:Time.now, preplocation: "Norris", notes: "NA") | |
ActiveRecord::UnknownAttributeError: | |
unknown attribute: user_id | |
# ./spec/models/appointment_spec.rb:7:in `new' | |
# ./spec/models/appointment_spec.rb:7:in `block (2 levels) in <top (required)>' | |
3) Appointment | |
Failure/Error: @appointment = Appointment.new(user_id: user.id, receiver_id: other_user.id, prepday:Date.today, preptime:Time.now, preplocation: "Norris", notes: "NA") | |
ActiveRecord::UnknownAttributeError: | |
unknown attribute: user_id | |
# ./spec/models/appointment_spec.rb:7:in `new' | |
# ./spec/models/appointment_spec.rb:7:in `block (2 levels) in <top (required)>' | |
4) Appointment | |
Failure/Error: @appointment = Appointment.new(user_id: user.id, receiver_id: other_user.id, prepday:Date.today, preptime:Time.now, preplocation: "Norris", notes: "NA") | |
ActiveRecord::UnknownAttributeError: | |
unknown attribute: user_id | |
# ./spec/models/appointment_spec.rb:7:in `new' | |
# ./spec/models/appointment_spec.rb:7:in `block (2 levels) in <top (required)>' | |
5) Appointment | |
Failure/Error: @appointment = Appointment.new(user_id: user.id, receiver_id: other_user.id, prepday:Date.today, preptime:Time.now, preplocation: "Norris", notes: "NA") | |
ActiveRecord::UnknownAttributeError: | |
unknown attribute: user_id | |
# ./spec/models/appointment_spec.rb:7:in `new' | |
# ./spec/models/appointment_spec.rb:7:in `block (2 levels) in <top (required)>' | |
6) Appointment | |
Failure/Error: @appointment = Appointment.new(user_id: user.id, receiver_id: other_user.id, prepday:Date.today, preptime:Time.now, preplocation: "Norris", notes: "NA") | |
ActiveRecord::UnknownAttributeError: | |
unknown attribute: user_id | |
# ./spec/models/appointment_spec.rb:7:in `new' | |
# ./spec/models/appointment_spec.rb:7:in `block (2 levels) in <top (required)>' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Appointment < ActiveRecord::Base | |
attr_accessible :notes, :prepday, :preplocation, :preptime, :receiver_id, :user_id | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
appointment_spec.rb | |
require 'spec_helper' | |
describe Appointment do | |
let(:user) { FactoryGirl.create(:user)} | |
let(:other_user) { FactoryGirl.create(:user)} | |
before do | |
@appointment = Appointment.new(user_id: user.id, receiver_id: other_user.id, prepday:Date.today, preptime:Time.now, preplocation: "Norris", notes: "NA") | |
end | |
subject { @appointment } | |
it { should respond_to(:user_id)} | |
it { should respond_to(:receiver_id)} | |
it { should respond_to(:prepday)} | |
it { should respond_to(:preptime)} | |
it { should respond_to(:preplocation)} | |
it { should respond_to(:notes)} | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wireless-165-124-217-23:prepfind Pete$ rake db:test:prepare | |
You have 1 pending migrations: | |
20130426215406 CreateAppointments | |
Run `rake db:migrate` to update your database then try again. | |
wireless-165-124-217-23:prepfind Pete$ rake db:migrate | |
== CreateAppointments: migrating ============================================= | |
-- create_table(:appointments) | |
rake aborted! | |
An error has occurred, this and all later migrations canceled: | |
SQLite3::SQLException: table "appointments" already exists: CREATE TABLE "appointments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "receiver_id" integer, "prepday" date, "preptime" time, "preplocation" varchar(255), "notes" text, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment