I have a table, created from a database migration:
class CreateTickets < ActiveRecord::Migration
def up
create_table :tickets, :primary_key => :tickets_id do |t|
t.string :title, null: false
t.text :body
t.datetime :create_date
t.integer :author_id
t.integer :status, null: false, default: 0
end
end
A model:
class Ticket < ActiveRecord::Base
attr_accessible :title, :body, :create_date, :author_id, :status
end
And when I try to create a record:
User.create(title: title,body: body,create_date: Time.zone.now, author_id: @author_id,status: 0)
I get this error:
Can't mass-assign protected attributes: title, body, create_date, author_id, status
What did I do wrong?