Argument Errors in Forms => Rails 1.2.2


#1

Anyone else experiencing argument errors with select and/or radio
buttons that wrap around models?

I’m using form for, and when i pass something like:

<%= form.select :object, @collection %>

or options_for_select(@collection))

it’ll say: argument error 1 for 0… so i’ll poke around and when i do

<%= form.select %>, or <%= form.select :object %>

it’ll say: argument error 0 for 2, and 1 for 2, respectively.

?


#2

Hey Dominic, what’s the representation of @collections and is it the
result of a database query? Please provide more detail. OK?

-Conrad


#3

Hey Conrad, there’s bad news when my scaffolding will yield the same
errors… so i may have messed something up somewhere. I’ll just be
re-installing instantrails here…

Conrad T. wrote:

Hey Dominic, what’s the representation of @collections and is it the
result of a database query? Please provide more detail. OK?

-Conrad


#4

Hey Dominic, did you update your environment.rb to use rails 1.2.2
instead of 1.1.6? Also, you’ll need to perform the following:

rake rails:update

-Conrad


#5

Somethings wrong with my ActiveRecord within my app ever since upgrading
from 1.6 to 1.2.2.

Is it possible some plugin is interfering with AR? Besides a text_field,
everything inside a form builder does not work (select, radio_box,
etc)…even through a scaffold…

yet when i scaffold a fresh new project, it does work…

ideas and/or thoughts would be great right now.

Dominic S. wrote:

Hey Conrad, there’s bad news when my scaffolding will yield the same
errors… so i may have messed something up somewhere. I’ll just be
re-installing instantrails here…

Conrad T. wrote:

Hey Dominic, what’s the representation of @collections and is it the
result of a database query? Please provide more detail. OK?

-Conrad


#6

Yes. I did all of that…well…I finally found the problem. It deals
with in_place_editing. It’s because i was using an extension found at:
http://www.akuaku.org/archives/2006/08/in_place_editor_1.shtml

Below is the source of the problem:

ActionView::Helpers::InstanceTag.class_eval do
attr_writer :nil_content_replacement

def value
  unless object.nil?
    v = object.send(@method_name)
    if @nil_content_replacement.nil?
      return v
    else
      (v.nil? || v.to_s.strip=='') ? @nil_content_replacement : v
    end
  end
end

end

I’m not going to lie. I have no idea what is going on there for it to
screw up the form builder…At least i found the problem…

Conrad T. wrote:

Hey Dominic, did you update your environment.rb to use rails 1.2.2
instead of 1.1.6? Also, you’ll need to perform the following:

rake rails:update

-Conrad