Help. I cannot find any help by searching…
I’m slowly creating an application using tutorial examples, etc, but I
think I’m missing something real basic:
Here’s the error message:
NameError in Mindreadr#display_images_from_mindreadr
undefined local variable or method `mindreadr_open_socket’ for
#<#Class:0x37c3b08:0x37c3a30>
Here are what I think are the key files:
display_images_from_mindreadr.rhtml (The “<%=” is the source of the
error)
I need to Open a Socket to MindReadr
<%= mindreadr_open_socket %>
Then Request some images
Then display the images
(without the <%= line, I get the other lines as text as I expected)
mindreadr_open_socket (I don’t think this is the problem…never gets
here…if you can see a problem with this code, let me know!)
require “socket”
STDOUT.flush
s = TCPSocket.open(“192.168.107.10”, 9000)
result = “MindReadr Request called”
mindreadr_controller.rb (mindreader_open_socket is defined here)
class MindreadrController < ApplicationController
def index
end
def display_images_from_mindreadr
# Basic action which calls _open_socket, _request, and _read
render(:layout => false)
end
def mindreadr_open_socket
# Connect to MindReader server/port
render(:layout => false)
end
def mindreadr_request
# Ask MindReadr for some images
render(:layout => false)
end
def mindreadr_read
# Read output from MindReadr
render(:layout => false)
end
def ajax_example
render(:layout => false)
end
index.rhtml (partial- this all works fine until I hit the action button)
<div id="mindreadrread_results">The images should go here
after clicking “click here”
<%= link_to_remote(“Click here for images for images to appear
above”,
:update => ‘mindreadrread_results’,
:url => { :action =>
:display_images_from_mindreadr }) %>
Something tells me I haven’t declared something in the right place.
Suggestions for debugging?
Thanks,
Dave