Saturday 15 September 2012

ruby - Datamapper - weird may not be NULL error -


I am using Datamapper in a simple application to track sales track. I have a day < / Code> class, such as:

  DataMaper in class day :: resource property: ID, serial,: key => True Property: Date, DateTime Property: Bestseller, String Property: Total_Money, Decimal Asset: Total_Sold, Integer Property: Total_देश, End :: End of Sale   

and Sales < / Code> class:

  classmaker in class sale :: resource related_to: day property: id, serial,: key => True Property: Name, String property: Zodiac, Integer property: Value, Integer termination   

When you try to add a new sales to the database, such as: < / P>

  s = Sale.new (: day => DayGate (1) ,:name = & gt; "Foo" ,: zodiac => "42" ,: value I get this error when I call  save . / Sell sales.date May   

I do not have sales in property, so I'm not sure Where is it coming? I first thought that the day object is getting set up one day, so I did d = day .get (1) .date = time.No and Save D, but this error does not resolve.

What did I do?

Edit Sqlite3 schema <"value" ("id" is not created) "priority", "name" VARCHAR (50), "zodiac" INTEGER, "value" INTEGER, "day_id" not tap, "drink_id" INTEG ER tap ); Create index "index_sales_de" on "sale" ("day_id"); Create index "index_slash_drink" on "sale" ("drink_ID");

I think I have decided it. Obviously, I had an old date property at one point in sales . I entered Ruby Interpreter, my model is needed and DataMapper.auto_migrate! To reset the whole database. has used this problem fixed.

No comments:

Post a Comment