Module: TentD::Model::UserScoped

Included in:
App, Follower, Following, Group, NotificationSubscription, Post, PostVersion, ProfileInfo
Defined in:
lib/tentd/model/user_scoped.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/tentd/model/user_scoped.rb', line 4

def self.included(base)
  base.class_eval do
    belongs_to :user, 'TentD::Model::User'
    before :valid? do
      self.user_id ||= User.current.id if User.current
    end
  end
end