rickthemick
2005-Nov-25 10:08 UTC
Using link_to_remote/remote_function outside of a Controller
Hello!
I have a problem that is quite anoying!
In side my Controller it is no problem to use the
link_to_remote/remote_function function to produce html stuff to include
in my .rhtml file. BUT if I want to do this in another object, for
eample if I inside my controller (init_test) want to do like this:
my_dropdown->get_html
in which I want to perform the link_to_remote/remote_function function
and then return the html it produces it fails. I get the following error
message:
################################################################
NoMethodError in Init_test#index
undefined method `url_for'' for #<Dropdown:0xe431a8>
RAILS_ROOT: .
Application Trace | Framework Trace | Full Trace
#{RAILS_ROOT}bla/bla/.../Ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_view/helpers/javascript_helper.rb:279:in
`remote_function''
#{RAILS_ROOT}/app/controllers/dropdown.rb:24:in `get_html''
#{RAILS_ROOT}/app/controllers/init_test_controller.rb:26:in `index''
#{RAILS_ROOT}/app/controllers/init_test_controller.rb:16:in `index''
......
################################################################
and the call looks like this:
################################################################
#I uses remote_function within a select_tag funtion call:
remote_function(:update => values_id,
:with => "val=+value",
:url => {:action => :update_blocks }))
################################################################
There might be a logical explanation to this behaviour but I cant figure
it out! Any help is appreciated!
/Rick
--
Posted via http://www.ruby-forum.com/.
