Pregunta

I'm pretty new to Rails, and trying to use PaperTrail to handle versioning for all of my models. I'm using PostgreSQL. I want to store the versions table for each model as a separate table, which the PaperTrail README assures me is possible (though it's been marked as an issue several times in the Rails 3 branch).

If I'm subclassing Version like so:

# Allow PaperTrail versions to be in a separate table.
class FooVersion < Version
  self.table_name = :foo_versions

  # For Postgres, according to PaperTrail README
  self.sequence_name = :foo_version_id_sequence
end

Is there a way to get PaperTrail to generate this migration for me? All it seems to want to do is generate a generic migration for a Version table.

¿Fue útil?

Solución

No, looking at the code it does not seem like paper_trail will generate it for you. There are only two migration file templates. One is for the generic versions table, and the other is for adding an object_changes column.

If there are no differences between your custom tables and the generic table other than the name, you can copy the generic migration and replace the table name and index accordingly.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top