Thanks for you answer.
> You have to first save the @video before accessing the id, that is when
> the
> after_create or after_save is triggered.
> In your Video class, the after save has access to the @video instance
> through the self keyword (self.id in your case).
>
I need to clarify this point.
When videos_controller.rb calls for 'create' action, a new instance gets
persisted, correct?
When doing so, 'after_create' is called as well. It seems to me that
when 'after_create' is called, the new video instance is already
created. Please correct me, if I'm wrong.
I tried this. but no good ( I knew it! )
after_create :create_first_script
def create_first_script
@script = Script.new(:video_id => self.id, :startp => 0, :text =>
'ToDo: ')
end
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 [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.