New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

activityko

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

activityko

  • 0.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Activityko

An activity logger for rails 5. It provides view helpers to render basic format of activity.

Installation

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

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.

class Group < ApplicationRecord
  act_as_activity_object
end
class Location <ApplicationRecord
  act_as_activity_object
end

or

class ApplicationRecord < ActiveRecord::Base
  act_as_activity_object
end

An activity_name method is added to all activity objects.

The User model is also an activity object.

View Helpers

User basic_activity method to display an activity

<% @activities.each do |a| %>
  <%= basic_activity %>
<% end %>

or basic_activity also accepts block

<% 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 gem. Check it out.

  <%= render_activity @activity%>

File structure

app:
  views:
    activities:
      <activity_obj_model>:
        _<activity_action>.html.erb

Contributing

Bug 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 code of conduct.

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 24 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc