We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
原来为三层:Vote 一对多 Question 一对多 Answer 新修改之后两层: Vote 一对多 VoteItem VoteItem一对多 点赞者 VoteItem 还记录提交者(用户)
title: 投票主题 finish_at: 生成报告日期 images: 图片 url: 引用网址 token: *短链接,原来已有
user: 创建者 vote_items: 选项 voted_users: 参与者
Vote.rand_next user 针对用户随机提供一个未投票的投票
title: 选项 vote: 投票 praised_users: 点赞者 praised_count: 点赞数
belongs_to :vote, inverse_of: :vote_items 从属投票 belongs_to :user, inverse_of: :vote_items 选项创建者
vote_item.praised_by? user 是否已点赞 vote_item.praise_by user 点赞
has_many :votes 创建的投票 has_and_belongs_to_many :voted_votes, class_name: 'Vote', inverse_of: :voted_users 参加的投票 has_many :vote_items 创建的选项 has_and_belongs_to_many :praised_vote_items, class_name: 'VoteItem', inverse_of: :praised_users 赞过的选项
The text was updated successfully, but these errors were encountered:
url 字段用不到了,我关联了一个 infocard 模型
Sorry, something went wrong.
已集成到 0.2
No branches or pull requests
原来为三层:Vote 一对多 Question 一对多 Answer
新修改之后两层: Vote 一对多 VoteItem
VoteItem一对多 点赞者
VoteItem 还记录提交者(用户)
Vote:
字段
title: 投票主题
finish_at: 生成报告日期
images: 图片
url: 引用网址
token: *短链接,原来已有
关系
user: 创建者
vote_items: 选项
voted_users: 参与者
函数
Vote.rand_next user 针对用户随机提供一个未投票的投票
VoteItem
字段
title: 选项
vote: 投票
praised_users: 点赞者
praised_count: 点赞数
关系
belongs_to :vote, inverse_of: :vote_items 从属投票
belongs_to :user, inverse_of: :vote_items 选项创建者
函数
vote_item.praised_by? user 是否已点赞
vote_item.praise_by user 点赞
User
关系
has_many :votes 创建的投票
has_and_belongs_to_many :voted_votes, class_name: 'Vote', inverse_of: :voted_users 参加的投票
has_many :vote_items 创建的选项
has_and_belongs_to_many :praised_vote_items, class_name: 'VoteItem', inverse_of: :praised_users 赞过的选项
The text was updated successfully, but these errors were encountered: