https://github.com/neume/activityko
An activity logger for rails 5
https://github.com/neume/activityko
activerecord activity-logger rails
Last synced: about 2 months ago
JSON representation
An activity logger for rails 5
- Host: GitHub
- URL: https://github.com/neume/activityko
- Owner: neume
- License: mit
- Created: 2017-11-24T03:58:58.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-24T04:03:29.000Z (over 7 years ago)
- Last Synced: 2024-10-18T15:16:23.836Z (7 months ago)
- Topics: activerecord, activity-logger, rails
- Language: Ruby
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Activityko
An activity logger for rails 5. It provides view helpers to render basic format of activity.## Installation
```ruby
gem 'activityko'
```And then execute:
$ bundle
Then generate model and migration files$ rails g activityko:install
$ rake db:migrate## Usage
### Owner of the Activity
Add this to your ```User``` model
```ruby
class User < ApplicationRecord
act_as_loggable
end
```
This will add ```create_activity(action, options={})``` method to your model
### Object of the Activity
Then, make all possible objects of ```Activity``` an activty object.```ruby
class Group < ApplicationRecord
act_as_activity_object
end
class Location
<%= basic_activity %>
<% end %>
```
or
basic_activity also accepts ```block```
```ruby
<% basic_activity @activity do%>
<%= activity_subj %>
<%= activity_action %>
<%= activity_dir_obj %>
<%= activity_prep %>
<%= activity_prep_obj %>
<%= activity_time %>
<% end %>
```You can customize each activity output by using ```render_activity```. Inspired by [Public Activity](https://github.com/chaps-io/public_activity) gem. Check it out.
```ruby
<%= render_activity @activity%>
```
File structure
```
app:
views:
activities:
:
_.html.erb
```
## ContributingBug reports and pull requests are welcome on GitHub at https://github.com/neume/activityko. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
## License
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).