Hi, I am quite new to rails and can''t use any rjs-templates.
The problem is, that he can''t use/find the methods in that template
e.g. ''page'' or ''replace_html''. I get an
error message on these
methods.
Here''s what I got so far in my example:
Controller:
----
class AjaxTestController < ApplicationController
layout ''application'', :except => :say_hello
def index
end
def say_hello
@message = "Hello World"
respond_to do |format|
format.js
end
end
end
----
Layout
----
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang=''en''>
<head>
<title>Ajax</title>
<%= javascript_include_tag :defaults %>
</head>
<body>
<%= yield %>
</body>
</html>
----
index.html.erb
----
<h1>Helloworld#index</h1>
<%= link_to_remote "Click",
:url => {:action => "say_hello"} %>
<p id=''message''>...</p>
----
say_hello.rjs
---
page.replace_html ''message'', @message
page.visual_effect(:highlight, ''message'', :duration => 0.5)
---
its quite simple but does not work anyway. I don''t guess why it
behaves like this. If I use the controller for that ajax request,
everything is ok...it''s just that template thing i can''t fix.
Anyone
got an idea where the problem might be?
On Jul 28, 2:47 am, Drrrrrr <Cran...-S0/GAf8tV78@public.gmane.org> wrote:> Hi, I am quite new to rails and can''t use any rjs-templates. > The problem is, that he can''t use/find the methods in that template > e.g. ''page'' or ''replace_html''. I get an error message on these > methods. >What error message ? Fred
That common "undefined local variable or method `page''" do you need that trace generated? ---- C:/RUBYRA~1/rails_apps/ajax_test/app/views/ajax_test/say_hello.rjs: 1:in `__instance _exec0'' C:/RUBYRA~1/rails_apps/ajax_test/app/views/ajax_test/say_hello.rjs: 1:in `_run_rjs_app47views47ajax_t est47say_hello46rjs'' C:/RUBYRA~1/rails_apps/ajax_test/app/controllers/ ajax_test_controller.rb:9:in `say_hello'' ---- On Jul 28, 12:35 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Jul 28, 2:47 am, Drrrrrr <Cran...-S0/GAf8tV78@public.gmane.org> wrote:> Hi, I am quite new to rails and can''t use any rjs-templates. > > The problem is, that he can''t use/find the methods in that template > > e.g. ''page'' or ''replace_html''. I get an error message on these > > methods. > > What error message ? > > Fred
Getting no error working properly -- Posted via http://www.ruby-forum.com/.
might it be possible that i break anything in my rails? maybe a gem or an option turned off? On Jul 28, 1:11 pm, Sijo Kg <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Getting no error working properly > -- > Posted viahttp://www.ruby-forum.com/.