GithubHelp home page GithubHelp logo

public-activity / public_activity Goto Github PK

View Code? Open in Web Editor NEW
2.9K 57.0 331.0 638 KB

Easy activity tracking for models - similar to Github's Public Activity

License: MIT License

Ruby 99.57% HTML 0.43%
activerecord ruby rails activity-stream tracking news-feed hacktoberfest

public_activity's Introduction

PublicActivity Code Climate Gem Version

public_activity provides easy activity tracking for your ActiveRecord, Mongoid 3 and MongoMapper models in Rails 6.1+. Simply put: it records what has been changed or created and gives you the ability to present those recorded activities to users - similarly to how GitHub does it.

Table of contents

Ruby/Rails version support

Version ~> 3.0`` supports Ruby 3.0+ and Rails 6.1+. For older Ruby versions (≤2.7) and Rails 5.0+ you can use version ~> 2.0` until you can upgrade to newer versions of Ruby + Rails.

Issues related to those unsupported versions of Ruby/Rails will be closed without resolution and PRs will not be accepted.

Example

Here is a simple example showing what this gem is about:

Example usage

Demo app

The source code of the demo is hosted here: https://github.com/pokonski/activity_blog

Screencast

Ryan Bates made a great screencast describing how to integrate Public Activity in your Rails Application.

Setup

Gem installation

You can install public_activity as you would any other gem:

gem install public_activity

or in your Gemfile:

gem 'public_activity'

Database setup

By default public_activity uses Active Record. If you want to use Mongoid or MongoMapper as your backend, create an initializer file in your Rails application with the corresponding code inside:

For Mongoid:

# config/initializers/public_activity.rb
PublicActivity::Config.set do
  orm :mongoid
end

For MongoMapper:

# config/initializers/public_activity.rb
PublicActivity::Config.set do
  orm :mongo_mapper
end

(ActiveRecord only) Create migration for activities and migrate the database (in your Rails project):

rails g public_activity:migration
rake db:migrate

Model configuration

Include PublicActivity::Model and add tracked to the model you want to keep track of:

For ActiveRecord:

class Article < ActiveRecord::Base
  include PublicActivity::Model
  tracked
end

For Mongoid:

class Article
  include Mongoid::Document
  include PublicActivity::Model
  tracked
end

For MongoMapper:

class Article
  include MongoMapper::Document
  include PublicActivity::Model
  tracked
end

And now, by default create/update/destroy activities are recorded in activities table. This is all you need to start recording activities for basic CRUD actions.

Optional: If you don't need #tracked but still want the comfort of #create_activity, you can include only the lightweight Common module instead of Model.

Custom activities

You can trigger custom activities by setting all your required parameters and triggering create_activity on the tracked model, like this:

@article.create_activity key: 'article.commented_on', owner: current_user

See this entry http://rubydoc.info/gems/public_activity/PublicActivity/Common:create_activity for more details.

Displaying activities

To display them you simply query the PublicActivity::Activity model:

# notifications_controller.rb
def index
  @activities = PublicActivity::Activity.all
end

And in your views:

<%= render_activities(@activities) %>

Note: render_activity is a helper for use in view templates. render_activity(activity) can be written as activity.render(self) and it will have the same meaning.

Note: render_activities is an alias for render_activity and does the same.

Layouts

You can also pass options to both activity#render and #render_activity methods, which are passed deeper to the internally used render_partial method. A useful example would be to render activities wrapped in layout, which shares common elements of an activity, like a timestamp, owner's avatar etc:

<%= render_activities(@activities, layout: :activity) %>

The activity will be wrapped with the app/views/layouts/_activity.erb layout, in the above example.

Important: please note that layouts for activities are also partials. Hence the _ prefix.

Locals

Sometimes, it's desirable to pass additional local variables to partials. It can be done this way:

<%= render_activity(@activity, locals: {friends: current_user.friends}) %>

Note: Before 1.4.0, one could pass variables directly to the options hash for #render_activity and access it from activity parameters. This functionality is retained in 1.4.0 and later, but the :locals method is preferred, since it prevents bugs from shadowing variables from activity parameters in the database.

Activity views

public_activity looks for views in app/views/public_activity.

For example, if you have an activity with :key set to "activity.user.changed_avatar", the gem will look for a partial in app/views/public_activity/user/_changed_avatar.(erb|haml|slim|something_else).

Hint: the "activity." prefix in :key is completely optional and kept for backwards compatibility, you can skip it in new projects.

If a view file does not exist, then p_a falls back to the old behaviour and tries to translate the activity :key using I18n#translate method (see the section below).

I18n

Translations are used by the #text method, to which you can pass additional options in form of a hash. #render method uses translations when view templates have not been provided. You can render pure i18n strings by passing {display: :i18n} to #render_activity or #render.

Translations should be put in your locale .yml files. To render pure strings from I18n Example structure:

activity:
  article:
    create: 'Article has been created'
    update: 'Someone has edited the article'
    destroy: 'Some user removed an article!'

This structure is valid for activities with keys "activity.article.create" or "article.create". As mentioned before, "activity." part of the key is optional.

Testing

For RSpec you can first disable public_activity and add the test_helper in rails_helper.rb with:

#rails_helper.rb
require 'public_activity/testing'

PublicActivity.enabled = false

In your specs you can then blockwise decide whether to turn public_activity on or off.

# file_spec.rb
PublicActivity.with_tracking do
  # your test code goes here
end

PublicActivity.without_tracking do
  # your test code goes here
end

Documentation

For more documentation go here

Common examples

Help

If you need help with using public_activity please visit our discussion group and ask a question there:

https://groups.google.com/forum/?fromgroups#!forum/public-activity

Please do not ask general questions in the Github Issues.

License

Copyright (c) 2011-2013 Piotrek Okoński, released under the MIT license

public_activity's People

Contributors

bigzed avatar brendon avatar chopraanmol1 avatar d4rky-pl avatar farnoy avatar fusion2004 avatar guilhermesimoes avatar harrigan avatar jeffpoulton avatar jtwhittington avatar julioolvr avatar kengreeff avatar krzysiek1507 avatar kyanny avatar ledermann avatar marcusg avatar miry avatar mssola avatar octimizer avatar pokonski avatar reiz avatar rmm5t avatar robuye avatar sbower avatar stas avatar stuxcrystal avatar terry90 avatar ur5us avatar vendethiel avatar yhru avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

public_activity's Issues

Can't set the owner of the activity?

Hi,

My app is using devise but I cant seem to get it to set the owner_id, Is there anything special I need to do?

have tried the below in my model

include PublicActivity::Model
tracked :owner => @current_user
include PublicActivity::Model
tracked :params => {:owner_id => @current_user}

any help would be appreciated, thanks in advance.

Support for Rails 4

How will the gem work on Rails 4 when the observers are being dropped?

will there be support for rails 4?

thanks

Support For Custom Activities

Are there any plans for supporting custom user activities in the future? Another nice feature might be to specify exactly what actions your want to track as opposed to Create, Update, Delete which might not even be used.

Controller storage and helpers for binding controllers

We need to provide a filter for ActionController to give PublicActivity reference to currently running controller. Use of Thread.current[]=. This will ease up how parameters are built up without explicit instructions in controllers.

Rspec cannot detect a owner from current_user.

I add the code below to assign owner, but RSpec cannot detect current_user.

class Article < ActiveRecord::Base
  tracked owner: Proc.new{ |controller, model| controller.current_user }
end

Do you have any solutions?

Routing Error uninitialized constant PublicActivity::Model

Hi,

Im using Rails 3.2.7 and Ruby 1.9.3 but keep getting this error

Routing Error

uninitialized constant PublicActivity::Model

I have followed all the instructions on how to add this to a model but cant get it to work. Any ideas what it could be?

Thanks

Fix warnings

Hi, I'm on latest released rails with public_activity from master. I get the following warnings when using/testing public_activity:

...
DEPRECATION WARNING: You're trying to create an attribute `recipient_type'. Writing arbitrary attributes on a model is deprecated. Please just use `attr_writer` etc. (called from create_activity at /home/stas/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/public_activity-911c4190580e/lib/public_activity/common.rb:84)
...

Since v0.4.0 is not released, thought you can take a look.
Thanks in advance.

Behavior when a tracked model changes itself

If a User model is tracked and the user updates itself (like update settings) the activity that comes out is

#<PublicActivity::Activity id: 7, trackable_id: nil, trackable_type: nil, owner_id: 2, owner_type: "User", key: "user.update", parameters: {}, recipient_id: nil, recipient_type: nil, created_at: "2012-12-24 13:52:06", updated_at: "2012-12-24 13:52:06">

shouldn't trackable id and type be the same as owner in this case?

Why is it nil? is this correct behavior?

Functional testing with public activity tracking

Hi,

I am trying to run a functional test with public activity tracking enabled (i need to include it in my test), but I am getting the following error, since conroller is nil:

NoMethodError: undefined method current_user' for nil:NilClass app/models/photo.rb:97:inblock in class:Photo'
test/functional/api/v1/photos_controller_test.rb:22:in `block in class:PhotosControllerTest'

Here is the code on line 97 of photo.rb

include PublicActivity::Model
tracked :owner => proc { |controller, model|
controller.current_user
}

The system works great when running in dev or prod environments.

Could you help?

thanks a lot for this great gem,

thimios

Model name and View tree name

My layout doesn't work:

Example:
model: my_model
tree: public_activity/my_model

After a while i found out that the layout helper expects a tree "public_activity/mymodel" because the :key is named "mymodel".

can't assign activity owner and recipient

I use ruby 1.9.3-p362 with rails 3.2.11, when I create an activity with owner or recipient, the owner and recipient fields still leaves blank.
1.9.3p362 :001 > pos = Post.first
Post Load (0.3ms) SELECT posts.* FROM posts LIMIT 1
=> #<Post id: 1, title: "A Guide To Create New Language", content: "Hello World!", created_at: "2013-01-14 07:57:34", updated_at: "2013-01-14 07:57:34">

1.9.3p362 :003 > pos.create_activity key: "some key", recipient: User.first
User Load (0.4ms) SELECT users.* FROM users LIMIT 1
(0.2ms) BEGIN
SQL (0.6ms) INSERT INTO activities (created_at, key, owner_id, owner_type, parameters, recipient_id, recipient_type, trackable_id, trackable_type, updated_at) VALUES ('2013-01-14 09:01:27', 'some key', NULL, NULL, '--- {}\n', NULL, NULL, 1, 'Post', '2013-01-14 09:01:27')
(52.1ms) COMMIT
=> nil

and my model as following:

class Post < ActiveRecord::Base
attr_accessible :content, :title
include PublicActivity::Model
tracked
end

class User < ActiveRecord::Base
attr_accessible :email, :nick_name
end
~

:params option on #tracked that can accept both strings and lambdas

The trick here is discarding attributes in lambdas, like so:

# if we want to build a param from model, we'd use
tracked :params => {:article_name => lambda { |_, model| model.name } }
# and if we'd want to build a param from controller:
tracked :author => lambda { |controller, _| controller.current_user.email }

Note: lambda verifies number of parameters passed, so underscores are needed in both cases.

Github behavior how?

In github stream get activities presented like so "bjensen commented on issue 114 on eternicode/bootstrap-datepicker 8 days ago"

Setting the owner is obvious with this gem, but how would one set the parent, in this issue: 'eternicode/bootstrap-datepicker' ?

DEPRECATION WARNING with rails 3.2

MacBook-Pro:atelier chussenot$ rake db:migrate
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in PublicActivity::Tracked instead. (called from include at /Users/chussenot/.rvm/gems/ruby-1.9.2-p290@atelier/gems/public_activity-0.3.2/lib/public_activity.rb:51)

Get a community/support resource

Following discussion in #55 lets setup a mailing list/google plus group and encourage people to ask there instead of opening tickets every time things do not work.

Thanks.

Tracking Specific model instances

for example @alice wants to track everything that @bob does (on all models)

Is there a way to do this?

Or for each tracking I would need to go over PublicActivity::Activity and get the appropriate track records?

Attribute which named archive made the too deep stack error.

I added the attribute name archive to a table. If I add "archive" to params, the server will show too deep stack error. I have change its name to deleted_question, it works fine.

Error:
ruby tracked owner: Proc.new{ |controller, model| controller.current_user }, params: { archive: :archive}

Work:
ruby tracked owner: Proc.new{ |controller, model| controller.current_user }, params: { deleted_question: :deleted_question}

get_controller - undefined method

After upgrading an application to rc1, I have been receiving the following error:

undefined method `get_controller' for PublicActivity:Module

This error is being thrown after the render_activity helper is called and only happens when there are Activity records within the database.

I can provide more details about my application or the stack trace if needed.

Default Params

I think I might be missing something but is there a way to add default params to my model - I need every activity to have an account_id for scoping. Is this possible?

create_activity doesn't work with include PublicActivity::Common

When using (include PublicActivity::Model with tracked), everything works fine. However, for a model where I only wish to record custom activities, and use (include PublicActivity::Common without tracked), I get error messages which references "create_activity" line with following error:

undefined method `public_activity_enabled?' for #< ..model object id...>

My create_activity statement is inside one of the model methods and looks like this:

create_activity(:schedule, :owner => creator, :recipient => account, :params => {:username => self.creator.username})

Custom db fields

Hello,
first of all - thank you for creating this amazing gem, you saved me a lot of work and i really appreciate it :)

Anyway, i have a small problem. I'm creating an app - let's call it an online restaurants catalogue. There are two models: Spot and City

What i need to do is to be able to display an activity stream on single Spot's profile but i also want to display activity streams on City's profiles (activity streams of spots which belongs to this city, not city's streams itself). Offcourse i can use params parameter for create_activity method when tracking Spot activity but it would be probably not quite optimal to query City's activity using SQL LIKE statements (they are quite heavy, right?). I decided it would better to add a column to activities table in which i will keep the city ID.

Is there any way to use custom table columns without hacking a public_activity source code ? Unfortunatelly, this code won't work:

@spot.create_activity key: 'spot.update', city_id: @spot.city.id

Thank you for any help!

Mass Assignment error on rails 3.2.3

Attempt to create new tracked record causes error "ActiveModel::MassAssignmentSecurity::Error (Can't mass-assign protected attributes: key, owner, parameters)"

Pusher privacy issue

We use Pusher and public_activity in a Rails app where all our live updates need to be kept private, and only shown to the users who are meant to see them.

I just saw that the current stable version of public_activity has Pusher as a dependency - good idea in principle, but unfortunately (correct me if I'm wrong) I think it pushes every activity on any tracked model onto the public activity-channel.

Since anyone could subscribe to this channel this kinda ruins our plans for keeping the updates private :P

Is this fixed in #12, i.e. the Pusher integration will be completely disabled unless we explicitly turn it on?

Example for custom activity

Is it possible to add to the readme an example of tracking a custom action from a controller?

or pointing to a page that describes it. I find it difficult to handle the docs without a particular order to learn it..

Map-reduce support

This is more like an open question.

I need a way to reduce the amount of repetitive activities so that if I get same keys for the same object, I could develop a strategy to map/merge those into a single entry.

Ideally I would patch public_activity to handle that for me. Anyone interested in getting something like this into the core or I should not even bother pitching this.

Thanks

Template not defined error

Tried installing and running the gem within a Rails 3.0 app and it throws an error of 'Template not defined' even though I created an initializer which loads the path of the yaml file?

activity owner

your gem is really amazing but I am intermediate rails developer..I am using rails 3.2.1 and ruby 1.8.7..In my Post model ,,which belongs to User ,,I need to get the the post owner and created_at in the activity
regards

Do we specifically need Pusher?

In the example, you used pusher in the activity_obeserver; is that specifically needed for it to work. I don't think so, but I can't get things to show in the view!

undefined method `public_activity_enabled?' for #<Product:0xb439134>

I am using rails 3.2.11 and i keep getting the following error when trying to create an activity

undefined method `public_activity_enabled?' for #Product:0xb439134

my model is like this

class Product < ActiveRecord::Base
include Authority::Abilities
include ApprovableModel
include PublicActivity::Common
#tracked :owner => proc {|controller, model| controller.current_administrator}

has_many :product_models, :dependent => :destroy
attr_accessible :name

validates :name, :presence => true, :uniqueness => true

end

and my controller update action is below

def update
@Product = Product.find(params[:id])

if @product.update_attributes(params[:product])
  redirect_to business_products_url, notice: 'Product was successfully updated.'
  @product.create_activity(:update, :owner => current_administrator)
else
  render action: "edit"
end

end

any help. Thanks

Deprecation Warnings

Hi, I'm getting warnings when activities are created.

DEPRECATION WARNING: You're trying to create an attribute recipient_id'. Writing arbitrary attributes on a model is deprecated. Please just use attr_writer etc. (called from create_activity at /home/rayko/.rvm/gems/ruby-1.9.3-p0@app/bundler/gems/public_activity-efcf74abb8f6/lib/public_activity/common.rb:84)
DEPRECATION WARNING: You're trying to create an attribute recipient_type'. Writing arbitrary attributes on a model is deprecated. Please just use attr_writer etc. (called from create_activity at /home/rayko/.rvm/gems/ruby-1.9.3-p0@app/bundler/gems/public_activity-efcf74abb8f6/lib/public_activity/common.rb:84)

I've updated public_activity to 0.5 and still have the warnings. I also ran the migration, when I updated from 0.3.3 to 0.3.4 though, and the 0.5 upgrade migration is just the same I already run back then, so I guess it wasn't necesary to re-run it. Also I'm using Rails 3.2.2

Able to use for Notifications instead of just Activities

I've been looking around quite a bit for something akin to Facebook Notifications. I think Public Activity could do this with a few simple changes.

  • Need to be able to use an arbitrary model as an activity, so that we could call an activity a notification instead
  • Needs to be able to tracked if the activity was viewed by the user
  • Needs to be able to handle callbacks so that after a user is notified we can send out an email.

I think that is basically it. I would be willing to take a stab at these changes if you are on board with them but I didn't want to add them if they wouldn't end up in master.

deprecation warning

DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in PublicActivity::Tracked instead. (called from <top (required)> at /Users/alec/Documents/Projects/RailsApps/progressorapp/config/application.rb:13)

Make Pusher a soft dependency

Since pusher is optional, it would be nice to make it a soft dependency and just mention it in the documentation if people really want to use it.

Thanks.

Pass block / configuration when calling `tracked`

We would like to be able to configure the tracked ActiveRecord hooks to determine whether or not an activity should be created.

In our case, we have a tracked model where we only want to create a corresponding Activity record if certain attributes were changed, but not others.

Could this be done as a block passed to the tracked method, or an options hash of some kind?

How to deactivate basic activities recording

In the example [How to] Create custom activities, it puts:
"Besides standard, automatic activities created on CRUD actions on your model (deactivatable), you can post your own activities that..."
The issue is that I haven't seen any clue on how to deactivate those basics activities. I just want to record the custom activities, but don't know how.
Sorry if this doesn't seems like an issue, but I searched for an answer on google and didn't find it. I don't know where else to ask. Thanks in advance!

uninitialized constant PublicActivity::Model::Trackable

Hi

Great gem.

In revision 5d5859c (1.0.0), I get an unitialized constant error. I think it has to do with the ORM support that you put in but I wasn't able to diagnose it further/fix it unfortunately. Stack trace is below.

For now, I'll back up a version or two, but wanted to let you know.

Thanks.

rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
uninitialized constant PublicActivity::Model::Trackable
/Users/gary/.rvm/gems/ruby-1.9.3-p194/bundler/gems/public_activity-5d5859c40feb/lib/public_activity.rb:47:in block in <module:Model>' /Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/concern.rb:119:inclass_eval'
/Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/concern.rb:119:in append_features' /Users/gary/Source/myapp/app/models/user.rb:12:ininclude'
/Users/gary/Source/myapp/app/models/user.rb:12:in <class:User>' /Users/gary/Source/myapp/app/models/user.rb:1:in<top (required)>'
/Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/inflector/methods.rb:230:in block in constantize' /Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/inflector/methods.rb:229:ineach'
/Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/inflector/methods.rb:229:in constantize' /Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/core_ext/string/inflections.rb:54:inconstantize'
/Users/gary/.rvm/gems/ruby-1.9.3-p194/bundler/gems/forem-03725d78827c/lib/forem.rb:37:in rescue in user_class' /Users/gary/.rvm/gems/ruby-1.9.3-p194/bundler/gems/forem-03725d78827c/lib/forem.rb:34:inuser_class'
/Users/gary/.rvm/gems/ruby-1.9.3-p194/bundler/gems/forem-03725d78827c/lib/forem/user_class_extensions.rb:2:in <top (required)>' /Users/gary/.rvm/gems/ruby-1.9.3-p194/bundler/gems/forem-03725d78827c/lib/forem/engine.rb:17:inblock in class:Engine'
/Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:429:in _run__3923762982401776762__prepare__602551583965757566__callbacks' /Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in__run_callback'
/Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in _run_prepare_callbacks' /Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:inrun_callbacks'
/Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.8/lib/action_dispatch/middleware/reloader.rb:74:in prepare!' /Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.8/lib/action_dispatch/middleware/reloader.rb:48:inprepare!'
/Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/application/finisher.rb:47:in block in <module:Finisher>' /Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/initializable.rb:30:ininstance_exec'
/Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/initializable.rb:30:in run' /Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/initializable.rb:55:inblock in run_initializers'
/Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/initializable.rb:54:in each' /Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/initializable.rb:54:inrun_initializers'
/Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/application.rb:136:in initialize!' /Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:inmethod_missing'
/Users/gary/Source/myapp/config/environment.rb:5:in <top (required)>' /Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/application.rb:103:inrequire_environment!'
/Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/application.rb:295:in block (2 levels) in initialize_tasks' /Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.3/lib/rake/task.rb:228:incall'
/Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.3/lib/rake/task.rb:228:in block in execute' /Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.3/lib/rake/task.rb:223:ineach'
/Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.3/lib/rake/task.rb:223:in execute' /Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.3/lib/rake/task.rb:166:inblock in invoke_with_call_chain'
/Users/gary/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in mon_synchronize' /Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.3/lib/rake/task.rb:159:ininvoke_with_call_chain'
/Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.3/lib/rake/task.rb:187:in block in invoke_prerequisites' /Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.3/lib/rake/task.rb:185:ineach'
/Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.3/lib/rake/task.rb:185:in invoke_prerequisites' /Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.3/lib/rake/task.rb:165:inblock in invoke_with_call_chain'
/Users/gary/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in mon_synchronize' /Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.3/lib/rake/task.rb:159:ininvoke_with_call_chain'
/Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.3/lib/rake/task.rb:152:in invoke' /Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.3/lib/rake/application.rb:143:ininvoke_task'
/Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.3/lib/rake/application.rb:101:in block (2 levels) in top_level' /Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.3/lib/rake/application.rb:101:ineach'
/Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.3/lib/rake/application.rb:101:in block in top_level' /Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.3/lib/rake/application.rb:110:inrun_with_threads'
/Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.3/lib/rake/application.rb:95:in top_level' /Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.3/lib/rake/application.rb:73:inblock in run'
/Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.3/lib/rake/application.rb:160:in standard_exception_handling' /Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.3/lib/rake/application.rb:70:inrun'
/Users/gary/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.3/bin/rake:33:in <top (required)>' /Users/gary/.rvm/gems/ruby-1.9.3-p194/bin/rake:23:inload'
/Users/gary/.rvm/gems/ruby-1.9.3-p194/bin/rake:23:in `

'
Tasks: TOP => db:migrate => environment

Namespaced Models compatibility broken

Hi guys,

This commit f2bc223 probably solves the camel-case naming issue, but it breaks the namespaced naming classes compatibility.

Keys for namespaces now look like this: my_engine/model.action where it should look like my_engine_model.action.

Disabling Default CRUD tracking

How do I disable default CRUD tracking for a model?

the reason I'm asking is that user.update registered as activity if a user logs in using devise which changes the sign_in_count and date, etc..

Default Tracking not setting owner

I've added

class Post< ActiveRecord::Base

include PublicActivity::Model
tracked

but when I look at PublicActivity::Activity I see that owner_id and type is nil.

the create action for Post has

@post=current_user.posts.new(params[:post])
if @post.save
....

shouldn't the activity should set its owner to current_user?

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.