I am a newbie. observe following screen shots, I have a model Books
with following columns.
class CreateBooks < ActiveRecord::Migration
def change
create_table :books do |t|
t.string :title
t.text :author
t.integer :price
t.integer :book_id
end
end
end
Later i add a coulumn to existing table like following
class AddBookIdToBooks < ActiveRecord::Migration
def change
add_column :books, :book_id, :integer
end
end
i add a record into table Book
using form helpers
. but it is storing book_id
value in the format of BigDecimal
notation insted of integer
. why it is storing like that?? Thanks in Advance.
observe following screen shot here
2.2.2 :023 > Book.all
Book Load (0.4ms) SELECT "books".* FROM "books"
=> #<ActiveRecord::Relation [#<Book id: 7, title: "Wings Of Fire", author: "kalam's", price: 120, created_at: "2015-12-09 09:57:10", updated_at: "2015-12-09 09:57:10", book_id: #<BigDecimal:4f39ea0,'0.1001E4',9(27)>>]>
Aucun commentaire:
Enregistrer un commentaire