在栏杆上的适当红宝石标签在红宝石矿中插值
想要在Ruby Mine中正确设置院子,任何建议都将不胜感激。
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
由于.user
是通过一个活动记录属于与关联,因此我得到的警告是:
Incompatible types
Required: User
Passed: ActiveRecord::Associations::BelongsToAssociation<User>
任何想法如何使此方法自动插入。会有意想不到的副作用吗?
我想在重要的方法和服务上尽可能接近记录的打字。我很感谢有关如何实现这一目标的任何好的教程 /指南?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论