Create with console

Hello everybody

i want to create a data with the console on an model in db.

This is the model:

class CreateBancas < ActiveRecord::Migration
def change
create_table :bancas do |t|
t.string :nome
t.string :cognome
t.integer :numero
t.integer :scadenza
t.integer :type

  t.timestamps
end

end
end

When i do an query like this:

Banca.create!(:nome => “eric”, :cognome => “noumedem”, :scadenza =>
“2016”, :numero => “123”, :type => “1”)
I have an error like so:

ActiveRecord::SubclassNotFound: Invalid single-table inheritance type: 1
is not a subclass of Banca
from
/home/eric/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-4.0.2/lib/active_record/inheritance.rb:178:in
subclass_from_attrs' from /home/eric/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-4.0.2/lib/active_record/inheritance.rb:22:innew’
from
/home/eric/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-4.0.2/lib/active_record/validations.rb:39:in
create!' from (irb):307 from /home/eric/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/commands/console.rb:90:instart’
from
/home/eric/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/commands/console.rb:9:in
start' from /home/eric/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/commands.rb:62:in<top (required)>’
from bin/rails:4:in require' from bin/rails:4:in

What is wrong here?

Thank you

I resolved a problem. Rails don’t like calling an colunm “type”

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs