开发者

Rails 2.3.8 attributes read error

开发者 https://www.devze.com 2023-03-27 01:18 出处:网络
Rails 2.3.8 Windows Server 2003 Server SQL Server 2005 Uhm, this error makes absolutely no sense at all. I\'ve checked it several times. Here is an example of the console.
  • Rails 2.3.8
  • Windows Server 2003
  • Server SQL Server 2005

Uhm, this error makes absolutely no sense at all. I've checked it several times. Here is an example of the console.

>> s = SaleItemArchive.find(118296)
=> #<SaleItemArchive id: 118296, sale_id: 60308, item_id: 19825, quantity: 40, p    rice: 0.75, created_at: "1998-08-10 00:00:00", quantity_shipped: 0>
>> s.created_at
=> nil
>> s.attributes["created_at"]
=> Mon Aug 10 00:00:00 UTC 1998
>>
>> s.class.match_attribute_method?("created_at")
=> nil
>> s.class.generated_methods.include?("created_at")
=> false
>>

Here's an example of a normal one.

>> s = SaleItemArchive.find(118297)
=> #<SaleItemArchive id: 118297, sale_id: 60309, item_id: 2931, quantity: 100, price: 0.07, created_at: "1998-08-10 00:00:00", quantity_shipped: 0>
>> s.created_at
=> Mon, 10 Aug 1998 00:00:00 PDT -07:00
>> s.attributes["created_at"]
=> Mon Aug 10 00:00:00 UTC 1998

I've tested it on dozens of other rows in the database and this is the only row in the entire database that gives me a problem. It makes absolutely no sense. Since there are no errors given, it took me a while to figure out what was going wrong. Any ideas?

I tried checking and for some reason the attribute method is not created. I've tried d开发者_Go百科uplicating this problem with new rows, editing other rows etc. Nothing. Please help.


Most probably case is the row in the database is just missing the row. The object still responds to the created_at method (since it doesn't throw an error), so the only explanation is that the column is null for that row.

0

精彩评论

暂无评论...
验证码 换一张
取 消