Form_for with partial using do |@f|

Is it possible to pass this FormBuilder object to a controller and then
back to a partial?

I have a form rendering a partial that i would like to update with a
call to my controller based on user selectable parameters, but when the
AJAX comes back, i get this error message because i cannot pass a form
builder object between the controller and the view:

“undefined method `text_area’ for
“#ActionView::Helpers::FormBuilder:0x12c4038”:String”

My View looks like this:

<% form_for @phrase, :action => ‘foo’ do |@f| -%>

     <%= select_tag(:language,

options_for_select([“Chinese”,“English”],
:onchange=> remote_function(:with =>
“‘language=’+this.value”,
:update => ‘slang_form_partial’,
:url => {:action => :something, :form => @f}
)) %>

 <%= render :partial => 'forms/slang_form_partial'%>

<%= @f.submit %>

In my controller i have something that looks like this:

def something
@default_language = params[:language]
@f = params[:form]
render :partial => ‘forms/slang_form_partial’
end

Is it possible to pass this FormBuilder object to a controller and then
back to a partial? Rails 2.1.0 and Ruby 1.8.6.

On 2 Dec 2008, at 02:03, Richard S. wrote:

Is it possible to pass this FormBuilder object to a controller and
then
back to a partial?

What you are doing can’t work. You can’t pass arbitrary ruby objects
as params to a url.

Fred