class Task < ActiveRecord::Base
has_many :notes, :as => :notable, :dependent => :destroy
has_many :work_times, :dependent => :destroy
end
class WorkTime < ActiveRecord::Base
belongs_to :task
end
class NotesController < ApplicationController
end
end
####
请帮忙吗?如何将价值从控制器传递给模型?
它看起来像你的“像”是正确的答案。它有什么问题? – 2011-04-20 17:22:50
这就是我为#获取未定义的方法'work_time'。我得到的日期,但最后一行代码* work_time.start_time ==时间是错误。 –
user659068
2011-04-20 17:28:02