mardi 23 juin 2015

Ruby on Rails (rake db:seed) - Undefined Attribute Error ___

I'm getting this error, "ActiveRecord: UndefinedAttributeError: Unknown Attribute: name" whenever I try to rake seed.db. I honestly have no idea what's wrong because I defined name in my migration files already.

Here's my code.

Seeds.rb -

 P1 = Post.create(name: "Arsenal")
 P2 = Post.create(name: "Chelsea")

Migration -

   class CreatePosts < ActiveRecord::Migration
      def change
        create_table :posts do |t|
          t.string :name
        end
      end
    end

Let me know if you need anymore files.

Thanks.

Aucun commentaire:

Enregistrer un commentaire