Coder Social home page Coder Social logo

blamer's Issues

respond_to?(updated_userstamp_column) always operating again User object only

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

Updates for Ruby 2

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 not threadsafe

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

Typo in documentation for custom userstamp columns

# 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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.