CodeRush™ with Refactor!™ Pro Powerful. Efficient. Fast.Today, software consumers demand more than ever before from developers. The pressure to deliver more features with higher quality in less time has never been greater. Developer Express create
有时我们的数据库查询操作条件多且比较复杂,这时我们可以将query refactor成model形式。
比如我们想通过用户找到他在某些课时下的某些任务的某些时间点完成的作业我们如何做呢?
先创建一个model,user_assignments_query.rb
创建一个class的时候,需要先定义参数。
class UserAssignmentsQuery
def initialize(user)
user = user
end
end
下面