RJS-Template and link_to_remote

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"?> Ajax <%= javascript_include_tag :defaults %> <%= yield %> ----

index.html.erb

Helloworld#index

<%= link_to_remote “Click”,
:url => {:action => “say_hello”} %>

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 [email protected] 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 C. [email protected]

Getting no error working properly

might it be possible that i break anything in my rails? maybe a gem or
an option turned off?

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