Dear all:
I''m new to Rails and I''ve encountered some problems with
ajax in
Rails 3. My project is on a Ubuntu 10.04 LTS machine with ruby v1.8.7
and rails v3.0.0.
I''ve changed my rails.js file according to :
http://github.com/rails/jquery-ujs/blob/master/src/rails.js
and also changed my javascript_include_tag to these three paths:
1."http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"
2."http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"
3."rails.js"
Everything works just fine except a controller with a ssh connection
behavior.
In my malfunctioned controller:
def remoteStatus
@ip = params[:server][:ip]
@sshid = params[:server][:sshid]
@sshpass = params[:server][:sshpass]
Net::SSH.start(@ip, @sshid, :password => @sshpass) do |
session.exec!("free | awk ''NR==2 {print rate =
$3/$2*100}''") do
|channel, stream, data|
@memusage = data
end
end
respond_to do |format|
format.js
end
end
In the remoteStatus.js.erb I have:
$(''#status_div'').append("<%=@memusage%>")
I am pretty sure that I can have the ssh connection result in variable
@memusage. But it seems that it never appends to the status_div block in
the corresponding view. I''m wondering if I am missing something
detailed. Can anyone help me here,please and thanks!
Best regards
--
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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.