Passing value from :locals to link_remote_to
Posted
by Teef L
on Stack Overflow
See other posts from Stack Overflow
or by Teef L
Published on 2010-06-05T08:04:31Z
Indexed on
2010/06/05
8:12 UTC
Read the original article
Hit count: 238
ruby-on-rails
|parameter-passing
In my edit.haml file, I have =render :partial => 'old_question_tags', :locals => {:current_question => @question.id}
.
I'd like to pass the value in :current_question to a link_to_remote call in _old_question_tags.haml:
#{link_to_remote image_tag('red-x.png', {:alt => "Remove #{t.name} tag"}), :url => {:action => 'remove_old_tag_from_question', :tag_remove => t.id, :current_question => current_question}}
But I get this error on the link_to_remote
line:
ActionView::TemplateError (undefined local variable or method `current_question' for #<ActionView::Base:0xdb2fec8>)
In _old_question_tags.haml, if I just print current_question (using =current_question
), it prints the number without any problems.
How do I properly pass that value to the partial so that I can pass it to the link_to_remote call?
© Stack Overflow or respective owner