All Projects → hopsoft → tag_columns

hopsoft / tag_columns

Licence: MIT license
Fast & simple Rails ActiveRecord model tagging using PostgreSQL's Array datatype

Programming Languages

ruby
36898 projects - #4 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to tag columns

activerecord-setops
Union, Intersect, and Difference set operations for ActiveRecord (also, SQL's UnionAll).
Stars: ✭ 21 (-47.5%)
Mutual labels:  ruby-gem, ruby-on-rails
Sidekiq Cron
Scheduler / Cron for Sidekiq jobs
Stars: ✭ 1,383 (+3357.5%)
Mutual labels:  ruby-gem, ruby-on-rails
Motion
Reactive frontend UI components for Rails in pure Ruby
Stars: ✭ 498 (+1145%)
Mutual labels:  ruby-gem, ruby-on-rails
Devise masquerade
Extension for devise, enable login as functionality. Add link to the masquerade_path(resource) and use it.
Stars: ✭ 380 (+850%)
Mutual labels:  ruby-gem, ruby-on-rails
request store-sidekiq
Provides an easy integration between RequestStore and Sidekiq
Stars: ✭ 32 (-20%)
Mutual labels:  ruby-gem, ruby-on-rails
Cloudinary gem
Cloudinary GEM for Ruby on Rails integration
Stars: ✭ 394 (+885%)
Mutual labels:  ruby-gem, ruby-on-rails
Ransack
Object-based searching.
Stars: ✭ 5,020 (+12450%)
Mutual labels:  ruby-gem, ruby-on-rails
katapult
Kickstart Rails development!
Stars: ✭ 21 (-47.5%)
Mutual labels:  ruby-gem, ruby-on-rails
Filestack Rails
Official Ruby on Rails plugin for Filestack File Picker that makes it easy to add powerful file uploading and transformation capabilities to any web or mobile application.
Stars: ✭ 220 (+450%)
Mutual labels:  ruby-gem, ruby-on-rails
Rorvswild
Ruby on Rails app monitoring: performances & exceptions insights for rails developers.
Stars: ✭ 159 (+297.5%)
Mutual labels:  ruby-gem, ruby-on-rails
Pattern
A collection of lightweight, standardized, rails-oriented patterns.
Stars: ✭ 377 (+842.5%)
Mutual labels:  ruby-gem, ruby-on-rails
activerecord-crate-adapter
Ruby on Rails ActiveRecord adapter for CrateDB
Stars: ✭ 27 (-32.5%)
Mutual labels:  ruby-gem, ruby-on-rails
Loaf
Manages and displays breadcrumb trails in Rails app - lean & mean.
Stars: ✭ 360 (+800%)
Mutual labels:  ruby-gem, ruby-on-rails
Matestack Ui Core
Matestack enables you to create sophisticated, reactive UIs in pure Ruby, without touching JavaScript and HTML. You end up writing 50% less code while increasing productivity, maintainability and developer happiness.
Stars: ✭ 469 (+1072.5%)
Mutual labels:  ruby-gem, ruby-on-rails
delayed-web
A rails engine that provides a simple web interface for exposing the Delayed::Job queue.
Stars: ✭ 71 (+77.5%)
Mutual labels:  ruby-gem, ruby-on-rails
React on rails
Integration of React + Webpack + Rails + rails/webpacker including server-side rendering of React, enabling a better developer experience and faster client performance.
Stars: ✭ 4,815 (+11937.5%)
Mutual labels:  ruby-gem, ruby-on-rails
slack widgets
An abstraction of the JSON structure needed to create widgets in Slack message attachments
Stars: ✭ 14 (-65%)
Mutual labels:  ruby-gem, ruby-on-rails
arask
Automatic RAils taSKs.
Stars: ✭ 31 (-22.5%)
Mutual labels:  ruby-gem, ruby-on-rails
Mailjet Gem
[API v3] Mailjet official Ruby GEM
Stars: ✭ 119 (+197.5%)
Mutual labels:  ruby-gem, ruby-on-rails
superglue
A productive library for Classic Rails, React and Redux
Stars: ✭ 106 (+165%)
Mutual labels:  ruby-gem, ruby-on-rails

Lines of Code Maintainability Build Status Coverage Status Downloads

TagColumns

Fast & simple Rails ActiveRecord model tagging using PostgreSQL's Array datatype. Similar to acts_as_taggable_on but lighter weight with fewer features. Also, be sure to check out acts_as_taggable_array_on.

Use Cases

Assign categories to your database records.

  • Assign multiple groups to user records
  • Assign categories to blog posts et al.
  • etc...

Quick Start

# Gemfile
gem "tag_columns"
# db/migrate/TIMESTAMP_add_groups_to_user.rb
class AddGroupsToUser < ActiveRecord::Migration[5.0]
  def change
    add_column :users, :groups, :string, array: true, default: [], null: false
    add_index :users, :groups, using: "gin"
  end
end
# app/models/user.rb
class User < ApplicationRecord
  include TagColumns
  tag_columns :groups
end
user = User.find(1)

# assigning tags
user.groups << :reader
user.groups << :writer
user.save

# checking tags
is_writer            = user.has_group?(:writer)
is_reader_or_writer  = user.has_any_groups?(:reader, :writer)
is_reader_and_writer = user.has_all_groups?(:reader, :writer)

# finding tagged records
assigned                = User.with_groups
unassigned              = User.without_groups
writers                 = User.with_any_groups(:writer)
non_writers             = User.without_any_groups(:writer)
readers_or_writers      = User.with_any_groups(:reader, :writer)
readers_and_writers     = User.with_all_groups(:reader, :writer)
non_readers_and_writers = User.without_all_groups(:reader, :writer)

# find unique tags across all users
User.unique_groups

# find unique tags for users with the last name 'Smith'
User.unique_groups(last_name: "Smith")
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].