Changeset 6061
- Timestamp:
- 01/28/07 07:58:02 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activerecord/CHANGELOG
r6051 r6061 1 1 *SVN* 2 3 * Use Date#to_s(:db) for quoted dates. #7411 [Michael Schoen] 2 4 3 5 * Don't create instance writer methods for class attributes. Closes #7401 [Rick] trunk/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
r5953 r6061 26 26 when BigDecimal then value.to_s('F') 27 27 else 28 if value.acts_like?(:date) 29 "'#{value.to_s}'" 30 elsif value.acts_like?(:time) 28 if value.acts_like?(:date) || value.acts_like?(:time) 31 29 "'#{quoted_date(value)}'" 32 30 else … … 51 49 "'t'" 52 50 end 53 51 54 52 def quoted_false 55 53 "'f'" 56 54 end 57 55 58 56 def quoted_date(value) 59 value. strftime("%Y-%m-%d %H:%M:%S")57 value.to_s(:db) 60 58 end 61 59 end trunk/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
r5937 r6061 126 126 end 127 127 128 # Include microseconds if the value is a Time responding to usec. 128 129 def quoted_date(value) 129 value.strftime("%Y-%m-%d %H:%M:%S.#{sprintf("%06d", value.usec)}") 130 if value.acts_like?(:time) && value.respond_to?(:usec) 131 "#{super}.#{sprintf("%06d", value.usec)}" 132 else 133 super 134 end 130 135 end 131 136