Proper Ruby on Rails YARD Tags Interpolation in Ruby Mine

82 Views Asked by At

Want to setup Yard properly in Ruby Mine and any advice would be appreciated.

class Entity < ApplicationRecord
  belongs_to :user
end

# @param user [User]
def authorized_for_user?(user)
  return true
end

# @param entity [Entity]
def check_authorization(entity)
  authorized_for_user?(entity.user) # The line that gets the following error
end

Since .user is through an active record belongs-to association, the warning I get is:

Incompatible types
Required: User
Passed: ActiveRecord::Associations::BelongsToAssociation<User>

Any idea how to make this automatically interpolate either. Will there be unintended side effects?

I want to get as close to documented typings as possible on important methods and services. I would appreciate any good tutorials / guides on how to achieve this?

0

There are 0 best solutions below