infused / blamer Goto Github PK
View Code? Open in Web Editor NEWBlamer adds userstamps to ActiveRecord models
License: MIT License
Blamer adds userstamps to ActiveRecord models
License: MIT License
Hi, thanks, this lib is what I was looking for.
I'm running into issues having this work in Rails 5.2.0, Ruby 2.5.1.
Following your setup. (note, I had to change before_filter to before_action)
The issue is that for any model update, respond_to?(updated_userstamp_column)
is always operating against the User object only.
For example, on Cars.save, (usertamp.rb) def _update_record(*args)
is essentially trying, User.respond_to?('updated_by')
, whereas I would expect it to be, Cars.respond_to?('updated_by')
Possibly I missed something in the set up?
I will try to work up a small test example to illustrate my point when I can.
Thanks again for your cool lib.
Cheers
Hey Keith!
Great looking gem! I'd love to use it, but it looks like it relies too heavily on pre-Ruby 2.0.. Do you have plans to update it to work with Ruby 2 and Rails 4?
Thanks!
Blamer is not threadsafe. I believe this is because Blamer is storing the current user in a constant as a class attribute (User.current_user = ...
). This causes creator_id
to be set to the wrong user if two users send a request simultaneously if you use a threaded web server (e.g., Puma, the recommended web-server for Heroku).
I've written the following code which demonstrates the bug: https://gist.github.com/audy/4bf963ee473dc2c113ee30c325291bb4
# Globally in environment.rb
ActiveRecord::Base.created_userstamp_column = :creator_id
ActiveRecord::Base.updated_userstamp_column = :updator_id
Should be :updater_id
instead of :updator_id
Cost me some time searching and scratching my head why it was not working.
Thank you for maintaining this gem!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.