我有:
User id:integer name:integer
class User
has_many :complete_tasks
end
Task id:integer style:string uid:string
CompleteTask id:integer style:string uid:string user_id:integer
class CompleteTask
belongs_to :user
end
我在数据库中有一些记录
user = User.first
id:1 名称:Den
tasks = Tasks.all
id:1 风格 => “奔跑” uid => “河流”
id:2 风格 => “跳跃” uid => “海”
id:3 风格 => “跑” uid =>“海”
id:4 风格 => “跑” uid => “河”
id:5 风格 => "运行" uid =>"森林"
user.complete_tasks.all
id:1 style => "run" uid => "river" user_id => 1
id:2 style => "jump" uid => "sea" user_id => 1
如何从任务中获取记录,其中字段:样式和:uid 一起不是模型 CompleteTask 中的等效字段:样式和:uid。