new record in rails console error -


a similar question asked, bud can't solve problem anyway. trying create new record in rails console , error:

    2.1.2 :001 > subject = subject.new mysql2::error: table 'simple_cms_development.subjects' doesn't exist: show full fields `subjects` activerecord::statementinvalid: mysql2::error: table 'simple_cms_development.subjects' doesn't exist: show full fields `subjects` 

can please tell should do?

here's subject.rb:

class subject < activerecord::base end 

and schema.rb:

activerecord::schema.define(version: 20140617074943)    create_table "admin_users", force: true |t|     t.string   "first_name", limit: 25     t.string   "last_name",  limit: 50     t.string   "email",                 default: "", null: false     t.string   "username",   limit: 25     t.string   "password",   limit: 40     t.datetime "created_at"     t.datetime "updated_at"   end    create_table "pages", force: true |t|     t.integer  "subject_id"     t.string   "name"     t.string   "permalink"     t.integer  "position"     t.boolean  "visible",    default: false     t.datetime "created_at"     t.datetime "updated_at"   end    add_index "pages", ["permalink"], name: "index_pages_on_permalink", using: :btree   add_index "pages", ["subject_id"], name: "index_pages_on_subject_id", using: :btree    create_table "sections", force: true |t|     t.integer  "page_id"     t.string   "name"     t.integer  "position"     t.boolean  "visible",      default: false     t.string   "content_tipe"     t.text     "content"     t.datetime "created_at"     t.datetime "updated_at"   end    add_index "sections", ["page_id"], name: "index_sections_on_page_id", using: :btree  end 

create_subjects.rb:

class createsubjects < activerecord::migration   def     create_table :subjects |t|       t.string "name"       t.integer "position"       t.boolean "visible" :default => false       t.timestamps     end   end    def down         drop_table :subjects   end  end 

add comma in

t.boolean "visible" :default => false` 

as in

t.boolean "visible", :default => false` 

and run rake db:migrate

making sure config/database.yml file has valid entry database connection on machine. @ development stanza.

more on migrations @ guides.rubyonrails.org/migrations.html

more on configuring database , database.yml file at

http://edgeguides.rubyonrails.org/configuring.html#configuring-a-database


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -