Forum: Ruby on Rails version_fu and text fields

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
tansaku (Guest)
on 2008-10-31 17:45
(Received via mailing list)
I'm having trouble with version_fu and text fields.  I'm posting to
the version_fu wiki:

http://github.com/jmckible/version_fu/wikis/troubleshooting

but here as well in case anyone can help - or can later benefit from
the cross-linking if we solve the problem:

Issue 2: wrong values for text/blob moved over to versioned table

the text field in the table created by the following:

def self.up
  create_table :statistic_type_versions do |t|
    t.integer :statistic_type_id, :statistic_category_id
    t.string  :name, :time_filter, :unit
    t.text    :sql
    t.timestamps
  end
  add_column :statistic_types, :version, :integer, :default=>1
end

appears to have the data from the new version rather than the old
version in it.  The old data appears to be lost, or as in the case
below the text/blob field may also just be nil.

>> type = StatisticType.new
=> #<StatisticType id: nil, name: "", time_filter: "", unit: "", sql:
nil, statistic_category_id: nil, version: 1>
>> type.name = 'original_name'
=> "original_name"
>> type.sql = 'original_sql'
=> "original_sql"
>> type.save
=> true
>> type.name
=> "original_name"
>> type.sql
=> "original_sql"
>> type.name = 'new_name'
=> "new_name"
>> type.sql = 'new_sql'
=> "new_sql"
>> type.save
=> true
>> type.name
=> "new_name"
>> type.sql
=> "new_sql"
>> type.id
=> 5
>> versioned_type = StatisticType::Version.find(:first, :conditions => 'statistic_type_id 
= 5')
=> #<StatisticType::Version id: 7, statistic_type_id: 5,
statistic_category_id: nil, version: 1, name: "original_name",
time_filter: "", unit: "", sql: nil, created_at: "2008-10-31
15:34:15", updated_at: "2008-10-31 15:34:15">
>> versioned_type.name
=> "original_name"
>> versioned_type.sql
=> nil

any ideas?

Many thanks in advance
CHEERS> SAM
This topic is locked and can not be replied to.