问题
I used paper_trail to tracking transnational changes when I migrated rails 3.2 to rails 4.2, have got below issue:
NoMethodError - undefined method `timestamp_sort_order' for
回答1:
I fixed this by adding below line in intializer paper_trail.rb file
PaperTrail::Rails::Engine.eager_load!
See my final intializers/paper_trail.rb file
PaperTrail::Rails::Engine.eager_load!
module PaperTrail
class Version < ActiveRecord::Base
.....
end
end
Problem resolved....
回答2:
got this on rails 6.0.0beta3 because I patched papertrail and forgot to add PaperTrail::VersionConcern
, e.g.:
module PaperTrail
class Version < ::ActiveRecord::Base
include PaperTrail::VersionConcern
end
end
PaperTrail::Rails::Engine.eager_load!
did not fix it for me
looking at the source code it's calling it directly on an ActiveRecord::Base
model, it's defined on PaperTrail::VersionConcern
.
来源:https://stackoverflow.com/questions/31716983/nomethoderror-undefined-method-timestamp-sort-order-for-paper-trail-issue-af