[英]rails How to migration find_all_by_
Hi I migrate an app from Rails 2 to Rails 7.04.您好,我将应用程序从 Rails 2 迁移到 Rails 7.04。
I don't see how to rewrite:我不知道如何重写:
self.accepted_roles.find_all_by_name(role_name).any? { |role| role.users }
users = self.accepted_roles.find_all_by_name(role_name).collect { |role| role.users }
users.flatten.uniq if users
I think self.roles.where("name="role_name).find_each
but .any?
我认为
self.roles.where("name="role_name).find_each
但.any?
and .collect
和
.collect
I don't find Rails 2 documentation.我找不到 Rails 2 文档。 Help is welcome
欢迎帮助
I think that .where()
is what you are looking for.我认为
.where()
就是您要找的东西。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.