But something like 

@video = Video.new({.....})
@script = @video.scripts.build({ :startp => 0, :text => 'ToDo: '})
@video.save

doesn't work?

Il giorno mercoledì 7 marzo 2012 10:01:30 UTC+1, Ruby-Forum.com User ha 
scritto:
>
> Rails 3.1.3
>
> I have models and their association like,
>
> Video 1: -------- n: Script
>
> When users newly create a Video, I want it to create the very first
> Script entry together.
>
> I have put
>
>     @script = Script.new(:video_id => @video.id, :startp => 0, :text =>
> 'ToDo: ')
>
> in Video controller, 'new' action, but it doesn't work (:startp value is
> determined for the first one).
>
> How can I create a Script entity together with Video?
>
> Also, if possible, I want that first Script entry to be undestroyable.
> Do you think I can do it?
>
> 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 view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/4na9OI1z2WYJ.
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.

Reply via email to