Migration?

Hello, I am fairly new to rails, and I keep having an error in my
migrations, cant mass assign protected attributes… it does not show
what
attribute is mass assigned, just shows the file that has the problem…
here is the file any help would be greatly appreciated!!

class Subjects < ActiveRecord::Migration
def self.up
create_table :subjects do |t|
t.column :name, :string
end
Subject.create :name => “Physics”
Subject.create :name => “Mathematics”
Subject.create :name => “Chemistry”
Subject.create :name => “Psychology”
Subject.create :name => “Geography”
end

def self.down
drop_table :subjects
end
end

Thanks!

try add Project.reset_column_information before Subject.create

On 17 June 2013 06:31, William H. [email protected]
wrote:

try add Project.reset_column_information before Subject.create

Or even Subject.reset_column_information

Colin

Don’t use migrations to set data, use seeds for that if you must. Using
migrations can lead to inabilities to rollback if need be.

The exceptions to this are cases where model relationships or default
values need to be set to have the application work. Your example is not
such a case.

You should add attr_accessible :name in model.
In latest version of rails all the attributes of model are bt default
protected.