Module: Maquina::UserScoped

Extended by:
ActiveSupport::Concern
Defined in:
app/models/concerns/maquina/user_scoped.rb

Overview

A concern that adds user association to models.

Usage

Include this concern in any model that needs to be scoped to a user:

class MyModel < ApplicationRecord
  include Maquina::UserScoped
end

Associations

When included, automatically adds:

  • user

    Belongs to a User through maquina_user_id foreign key

Example

class Document < ApplicationRecord
  include Maquina::UserScoped
  # Document now has user association
end

document = Document.create(user: current_user)
document.user # => returns associated Maquina::User