after_save does not work consecutively

Soichi Ishida
Fri, 16 Mar 2012 05:16:40 -0000

Rails 3.1.3

Related to my old thread

http://www.ruby-forum.com/topic/3802905#new

video.rb has

  after_save :create_first_script
  private
  def create_first_script
    @script = Script.new(:video_id => self.id, :startp => 0, :text =>
''ToDo: '')
    @script.save
  end


The problem is that after destroying all data, a freshly created video
DOES create the first Script, but the following videos DO NOT.

I have added User table so that Video and Script classes are only
editable for Users that own them.
The association is

User:1 -- n:Video:1--n:Script

To be honest, I have no idea which part of my code is causing this
problem.  I am sure the information provided here is not enough.  I
appreciate if you point out what I need to show you in order to gain
some help.

Thanks in advance.