public-activity / public_activity

Easy activity tracking for models - similar to Github's Public Activity
MIT License
2.96k stars 334 forks source link

Error in Rails 6 #339

Open wernerlaude opened 5 years ago

wernerlaude commented 5 years ago

I have: class ApplicationController < ActionController::Base protect_from_forgery with: :exception include PublicActivity::StoreController

class Documentation < ApplicationRecord include PublicActivity::Model tracked owner: Proc.new{ |controller, model| controller.current_user }

and i get: unknown attribute 'owner' for PublicActivity::Activity. Not working in Rails6? Thanks for help.

rajraj commented 5 years ago

@wernerlaude using master branch seems to have fixed this issue for me,

gem 'public_activity', github: 'chaps-io/public_activity', branch: 'master'
wernerlaude commented 5 years ago

Thanks..

dmitry commented 5 years ago

Could be closed after the release :)

pokonski commented 5 years ago

master is not releasable, so not sure how that fixed the issue for Rails 6, It's a 2 years old branch :grin:

Can you try 1-6-stable branch?

tbuehlmann commented 5 years ago

Confirmed, it works with Rails 6.0.0.rc1 and the 1-6-stable branch.

jesperronn commented 5 years ago

Since Rails 6 is coming up, could you make a release of the 1-6 branch so that everybody are able to test if the rest of their application are releasable with Rails 6.

hllewelyn commented 4 years ago

Any news on a release that's compatible with Rails 6?

pokonski commented 4 years ago

Hey guys, I released 1.6.4, can you please try if it helped? /cc @hllewelyn @jesperronn @tbuehlmann @dmitry

pduersteler commented 4 years ago

Just tried it out, switching from the 1-6-stable branch to 1.6.4 seems to work for me.

Feuda commented 4 years ago

As of 1.6.4 version, I have Rails 6 and Mongoid with mongoid orm configration, but I got ActiveRecord::ConnectionNotEstablished...No connection pool with 'primary' found, the Database setup seems did not take effect. @pokonski

ntloi95 commented 4 years ago

I have a same issue with Feuda when using with MongoId ActiveRecord::ConnectionNotEstablished...No connection pool with 'primary' found

dfabreguette commented 3 years ago

same issue here, pretty blocking. Has anyone a workaround for that ?

dmitry commented 3 years ago

@dfabreguette-ap seems like repo is abandoned, you can check some forks here: https://github.com/chaps-io/public_activity/network

ur5us commented 10 months ago

@Feuda @dfabreguette @dmitry Is that still a problem for you? Development stalled for a while but overall this gem is not abandoned; quite the opposite. However, personally, I have no need for Mongo, so not sure the adapters even work at this point. I’ll happily accept a patch. Otherwise, I might remove the Mongo adapters entirely.

noctivityinc commented 1 month ago

@ur5us good to hear. Do you have a fix for this issue. I have the exact same problem in Rails 7. I get things like

rails | NoMethodError (protected method `current_user' called for an instance of ItemsController):

when everything is setup as per the 2012 docs

ur5us commented 1 month ago

@noctivityinc Not in front of my computer but it looks like the current_user method is not private so you'd need to adapt the following line:

# change this
tracked owner: Proc.new{ |controller, model| controller.current_user }
# to this
tracked owner: Proc.new{ |controller, model| controller.send :current_user }
noctivityinc commented 1 month ago

Perfect thanks. Im also wondering if the new Current class can be used.

On Aug 9, 2024 at 3:54:36 PM, Juri Hahn @.***> wrote:

@noctivityinc https://github.com/noctivityinc Not in front of my computer but it looks like the current_user method is not private so you'd need to adapt the following line:

change thisinclude PublicActivity::Modeltracked owner: Proc.new{ |controller, model| controller.current_user }# to thisinclude PublicActivity::Modeltracked owner: Proc.new{ |controller, model| controller.send :current_user }

— Reply to this email directly, view it on GitHub https://github.com/public-activity/public_activity/issues/339#issuecomment-2278646088, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAATIAXGOHD2OR5HJDOAFKTZQUM7ZAVCNFSM6AAAAABMIZFTXSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZYGY2DMMBYHA . You are receiving this because you were mentioned.Message ID: @.***>