Re: [Rails] has_many association and parent_id

2012-01-29 Thread Dave Aronson
On Sun, Jan 29, 2012 at 05:45, Soichi Ishida wrote: > Furthermore, in order to refer to the parent (in this case, 'Video'), I > need to set video_id:integer for Script.  Am I correct ? Yes. > how can I actually associate a new 'script' entry with > its parent, 'video', in making a new 'Script'

[Rails] has_many association and parent_id

2012-01-29 Thread Soichi Ishida
Rails 3.1.3 Hi everyone again. I'm trying to develop a database and tables which have the association as follows. Video 1 - 0..n Script So, in 'script.rb' class Script < ActiveRecord::Base belongs_to :video ... end and in 'video.rb' class Video < ActiveRecord::Base has_many :scripts