Logging added for most models

This commit is contained in:
Priit Tark 2015-01-29 12:50:59 +02:00
parent 09a816d5a8
commit c3675c1b2a
46 changed files with 285 additions and 28 deletions

View file

@ -0,0 +1 @@
Will generate custom PaperTrail version model

View file

@ -0,0 +1,4 @@
class <%= class_name %>Version < PaperTrail::Version
self.table_name = :log_<%= file_name.tableize %>
self.sequence_name = :log_<%= file_name.tableize %>_id_seq
end

View file

@ -0,0 +1,11 @@
class VersionGenerator < Rails::Generators::NamedBase
source_root File.expand_path("../templates", __FILE__)
def create_version_file
template "version.rb.erb", "app/models/version/#{file_name}_version.rb"
end
def class_name
file_name.camelize
end
end