Thursday, March 15, 2012

[Rails] after_save does not work consecutively

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.

soichi

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate