Calling JS from controller and RJS

MaM o_0 wrote:

Hi,
I have solved this issue by myself, but I think it's a dirty way to go.
Please if someone knows a better way to do it, please let me know.

This is how I call JS from the controller
controller.rb:
def someAction
  render :text => "JSfoo()",
      :content_type => "text/javascript"
end

and this is how I call it from RJS
RJSfoo.rjs:
page << 'JSfoo()'

Why doesn't the RJS method work in the controller (I tried it), and is
there a better way to call JS from the controller?
Thanks!

--
Posted via http://www.ruby-forum.com/.

How about this... in your controllerj

def some_action
  render :update do |page|
   page.call "JSfoo"
  end
end

_Kevin