Started POST "/scripts" for 127.0.0.1 at 2012-02-16 15:53:50 +0900
Processing by ScriptsController#create as JS
Parameters: {"utf8"=>"✓",
"authenticity_token"=>"9rMiPwxlQrXiAIgUy8Qqe77KXDezXmpLF4WLupZb5ME=",
"script"=>{"video_id"=>"18", "startp"=>"85", "text"=>"korejyadamedann"},
"commit"=>"save"}
(0.1ms) SELECT 1 FROM "scripts" WHERE "scripts"."startp" = 85 LIMIT
1
SQL (0.7ms) INSERT INTO "scripts" ("created_at", "startp", "text",
"updated_at", "video_id") VALUES (?, ?, ?, ?, ?) [["created_at", Thu,
16 Feb 2012 06:53:50 UTC +00:00], ["startp", 85], ["text",
"korejyadamedann"], ["updated_at", Thu, 16 Feb 2012 06:53:50 UTC
+00:00], ["video_id", 18]]
Rendered videos/save.js.erb (1.5ms)
Completed 500 Internal Server Error in 138ms
ActionView::Template::Error (Called id for nil, which would mistakenly
be 4 -- if you really wanted the id of nil, use object_id):
1:
2:
3: $('#listtrans').html('<%= escape_javascript(render :partial =>
"videos/script_list", :locals => { :scripts =>
Script.find_all_by_video_id(@video.id) } ) %>');
4:
5:
6:
app/views/videos/save.js.erb:3:in
`_app_views_videos_save_js_erb__2673251445733535399_2157206780'
app/controllers/scripts_controller.rb:47:in `block (2 levels) in
create'
app/controllers/scripts_controller.rb:43:in `create'
It's most likely that @video (the instance variable you want the id
of) is nil. Use debugging techniques to break into the code where it's
being set and being used to inspect it.
you should not use js with erb, it meet serious problem when you change variable rails without change js. You can use client variable gem, checkout more details https://github.com/Coffa/client_variable