
Frozen DateTime of Postgresql Backed DataObjects
Reported by Reza Prima | November 23rd, 2007 @ 11:52 AM
I followed Sinatra+DataMapper tutorial at http://blog.zerosum.org/2007/11/... using postgresql 8.1 and I bumped to a problem in displaying "created_at" field, stating TypeError: can't modify frozen object.
I tracked down the problem using irb and found that created_at is frozen and can not formatted with strftime nor to_s.
>> class Snippet < DataMapper::Base
>> property :body, :text
>> property :created_at, :datetime
>> property :updated_at, :datetime
>> end
=> :updated_at
>> @snippet = Snippet.find(2)
=> .....
>> p @snippet.created_at.to_s
TypeError: can't modify frozen object
from (eval):4:in `jd'
from /usr/lib/ruby/1.8/date.rb:1041:in `__26129__'
from (eval):4:in `civil'
from /usr/lib/ruby/1.8/date.rb:1056:in `year'
from /usr/lib/ruby/1.8/date/format.rb:230:in `strftime'
from /usr/lib/ruby/1.8/date/format.rb:201:in `gsub'
from /usr/lib/ruby/1.8/date/format.rb:201:in `strftime'
from /usr/lib/ruby/1.8/date/format.rb:1057:in `strftime'
from /usr/lib/ruby/1.8/date.rb:1343:in `to_s'
from (irb):19
Comments and changes to this ticket
-
Sam Smoot December 10th, 2007 @ 01:52 PM
- State changed from new to resolved
This should be resolved in trunk. Changed the behaviour of the loader over the weekend to #dup instead of #freeze for original_values.
-
comboy November 11th, 2008 @ 09:30 AM
- Tag set to bug, dataobjects
still broken in the edge (0.9.7)
-
comboy November 11th, 2008 @ 09:39 AM
argh, forgive me, too many tichets on oponed in one browser and I sent it into the wrong one.
Too bad lighthouse doesn't have option to delete own comments
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »