Do know why fresh created video can create script but following video does not. What i am 100% sure is that after_save is not right place to put this logic. Cause any object's update will invoke after save, so new script will created every update.

--
rubyonrailsx
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Friday, March 16, 2012 at 1:16 PM, Soichi Ishida wrote:

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-t[email protected] (mailto:[email protected]).
To unsubscribe from this group, send email to [email protected] (mailto:[email protected]).
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

--
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 [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 5 | next ›
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedMar 16, '12 at 5:17a
activeMar 16, '12 at 10:08a
posts5
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Soichi Ishida: 3 posts Rubyonrailsx: 2 posts

People

Translate

site design / logo © 2023 Grokbase