Why javascript is never called in the view index

if i rendered in the controller
def index
@tips = Tip.all

respond_to do |format|

  format.html # index.html.erb
  format.js   { render :nothing => true }

  format.xml  { render :xml => @tips }
end

end
the complete source, the view index, the index.js.erb and the controller
http://pastie.org/1576136

please help

Never rendering

Started GET “/tips” for 127.0.0.1 at Thu Feb 17 14:38:15 -0600 2011
Processing by TipsController#index as HTML
Tip Load (0.6ms) SELECT tips.* FROM tips
Tiptag Load (0.3ms) SELECT tiptags.* FROM tiptags WHERE
(tiptags.tips_id = 37)
Tiptag Load (0.2ms) SELECT tiptags.* FROM tiptags WHERE
(tiptags.id = 37) LIMIT 1
Tag Load (0.2ms) SELECT tags.* FROM tags WHERE (tags.id = 3)
LIMIT 1
Tiptag Load (0.3ms) SELECT tiptags.* FROM tiptags WHERE
(tiptags.tips_id = 48)
Tiptag Load (1.0ms) SELECT tiptags.* FROM tiptags WHERE
(tiptags.id = 47) LIMIT 1
Tag Load (0.1ms) SELECT tags.* FROM tags WHERE (tags.id = 11)
LIMIT 1
Tiptag Load (0.1ms) SELECT tiptags.* FROM tiptags WHERE
(tiptags.id = 48) LIMIT 1
Tag Load (0.1ms) SELECT tags.* FROM tags WHERE (tags.id = 12)
LIMIT 1
Tiptag Load (0.2ms) SELECT tiptags.* FROM tiptags WHERE
(tiptags.tips_id = 49)
Tiptag Load (0.2ms) SELECT tiptags.* FROM tiptags WHERE
(tiptags.id = 49) LIMIT 1
CACHE (0.0ms) SELECT tags.* FROM tags WHERE (tags.id = 11)
LIMIT 1
Tiptag Load (0.1ms) SELECT tiptags.* FROM tiptags WHERE
(tiptags.id = 50) LIMIT 1
CACHE (0.0ms) SELECT tags.* FROM tags WHERE (tags.id = 12)
LIMIT 1
Tiptag Load (0.2ms) SELECT tiptags.* FROM tiptags WHERE
(tiptags.tips_id = 50)
Tiptag Load (0.2ms) SELECT tiptags.* FROM tiptags WHERE
(tiptags.tips_id = 51)
Tiptag Load (0.1ms) SELECT tiptags.* FROM tiptags WHERE
(tiptags.id = 51) LIMIT 1
Tag Load (0.1ms) SELECT tags.* FROM tags WHERE (tags.id = 13)
LIMIT 1
Tiptag Load (0.2ms) SELECT tiptags.* FROM tiptags WHERE
(tiptags.id = 52) LIMIT 1
Tag Load (0.2ms) SELECT tags.* FROM tags WHERE (tags.id = 14)
LIMIT 1
Tiptag Load (0.2ms) SELECT tiptags.* FROM tiptags WHERE
(tiptags.tips_id = 52)
Tiptag Load (0.1ms) SELECT tiptags.* FROM tiptags WHERE
(tiptags.id = 56) LIMIT 1
CACHE (0.0ms) SELECT tags.* FROM tags WHERE (tags.id = 14)
LIMIT 1
Tiptag Load (0.1ms) SELECT tiptags.* FROM tiptags WHERE
(tiptags.id = 57) LIMIT 1
Tag Load (0.1ms) SELECT tags.* FROM tags WHERE (tags.id = 19)
LIMIT 1
Tiptag Load (0.2ms) SELECT tiptags.* FROM tiptags WHERE
(tiptags.tips_id = 63)
Tiptag Load (0.2ms) SELECT tiptags.* FROM tiptags WHERE
(tiptags.id = 64) LIMIT 1
Tag Load (0.1ms) SELECT tags.* FROM tags WHERE (tags.id = 25)
LIMIT 1
Tiptag Load (0.2ms) SELECT tiptags.* FROM tiptags WHERE
(tiptags.tips_id = 64)
Tiptag Load (0.1ms) SELECT tiptags.* FROM tiptags WHERE
(tiptags.id = 65) LIMIT 1
CACHE (0.0ms) SELECT tags.* FROM tags WHERE (tags.id = 25)
LIMIT 1
Tiptag Load (0.2ms) SELECT tiptags.* FROM tiptags WHERE
(tiptags.tips_id = 65)
Tiptag Load (0.1ms) SELECT tiptags.* FROM tiptags WHERE
(tiptags.id = 66) LIMIT 1
CACHE (0.0ms) SELECT tags.* FROM tags WHERE (tags.id = 25)
LIMIT 1
Tiptag Load (0.2ms) SELECT tiptags.* FROM tiptags WHERE
(tiptags.tips_id = 67)
Tiptag Load (0.1ms) SELECT tiptags.* FROM tiptags WHERE
(tiptags.id = 68) LIMIT 1
CACHE (0.0ms) SELECT tags.* FROM tags WHERE (tags.id = 25)
LIMIT 1
Tiptag Load (0.2ms) SELECT tiptags.* FROM tiptags WHERE
(tiptags.tips_id = 68)
Tiptag Load (0.1ms) SELECT tiptags.* FROM tiptags WHERE
(tiptags.id = 69) LIMIT 1
Tag Load (0.1ms) SELECT tags.* FROM tags WHERE (tags.id = 4)
LIMIT 1
Tiptag Load (0.1ms) SELECT tiptags.* FROM tiptags WHERE
(tiptags.id = 70) LIMIT 1
Tag Load (0.1ms) SELECT tags.* FROM tags WHERE (tags.id = 9)
LIMIT 1
Rendered tips/index.html.erb within layouts/todoform (87.1ms)
Completed 200 OK in 99ms (Views: 83.9ms | ActiveRecord: 7.3ms)

On Thu, Feb 17, 2011 at 2:31 PM, Lorenzo Brito M.

On Feb 17, 8:31pm, Lorenzo Brito M. [email protected]
wrote:

the complete source, the view index, the index.js.erb and the
controllerhttp://pastie.org/1576136

please help

What’s the question ? I don’t understand from what you’ve written the
difference between what you’re getting and what you’re expecting

Fred

im expecting
thata its gets execute
$(document).ready(function(){
alert(‘ox’);

}
in the index.js.erb

On Thu, Feb 17, 2011 at 3:24 PM, Frederick C.

Thanks, it works, the thing is that i did thing that the _index.js.erb
is for put all the javascript,but
now i see that i just to work for ajax things, i think it was a way to
organize javascrit code.

the line

format.js {render :nothing => true}

renders, well, nothing. so it gives a blank page. if you want the action
to
render
the corresponding template, remove the render function.

On Fri, Feb 18, 2011 at 5:34 AM, Lorenzo Brito M. <
[email protected]> wrote:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs