Wacky View errors

I have what seems to be internal errors in my views, according to my
functional tests:


test_no_param_edit_member(MemberListControllerTest):
ActionView::TemplateError: undefined method `merge’ for “First
name”:String
On line #6 of member_list/edit_member.rhtml

3: </h1>
4: <div id="edit">
5:   <% form_for :person do |form| %>
6:     <%= form.label :person, :first_name, 'First name'    %>
7:       <%= form.text_field :first_name, :size => 30      %>
8:     <%= form.label :person, :last_name, 'Last name'       %>
9:       <%= form.text_field :last_name, :size => 30       %>

c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/

helpers/form_helper.rb:660:in label' app/views/member_list/edit_member.rhtml:6:in_run_erb_47app47views47member_list47edit_member46rhtml’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/
helpers/form_helper.rb:248:in fields_for' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/ helpers/form_helper.rb:184:inform_for’
app/views/member_list/edit_member.rhtml:5:in
_run_erb_47app47views47member_list47edit_member46rhtml' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/ base.rb:637:insend’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/
base.rb:637:in compile_and_render_template' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/ base.rb:365:inrender_template’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/
base.rb:316:in render_file' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/base.rb:1100:inrender_for_file’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
action_controller/base.rb:858:in render_with_no_layout' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/base.rb:872:inrender_with_no_layout’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
action_controller/layout.rb:262:in render_without_benchmark' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/benchmarking.rb:51:inrender’
c:/ruby/lib/ruby/1.8/benchmark.rb:293:in measure' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/benchmarking.rb:51:inrender’
app/controllers/member_list_controller.rb:20:in edit_member' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/base.rb:1158:insend’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
action_controller/base.rb:1158:in perform_action_without_filters' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/filters.rb:697:incall_filters’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
action_controller/filters.rb:689:in perform_action_without_benchmark' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/benchmarking.rb:68:inperform_action_without_rescue’
c:/ruby/lib/ruby/1.8/benchmark.rb:293:in measure' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/benchmarking.rb:68:inperform_action_without_rescue’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
action_controller/rescue.rb:199:in perform_action_without_caching' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/caching.rb:678:inperform_action’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2-/lib/
active_record/connection_adapters/abstract/query_cache.rb:33:in
cache' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2-/lib/ active_record/query_cache.rb:8:incache’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
action_controller/caching.rb:677:in perform_action' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/base.rb:524:insend’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
action_controller/base.rb:524:in process_without_filters' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/filters.rb:685:inprocess_without_session_management_support’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
action_controller/session_management.rb:123:in process_without_test' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/test_process.rb:15:inprocess’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
action_controller/test_process.rb:393:in process' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/test_process.rb:364:inpost’
member_list_controller_test.rb:203:in test_no_param_edit_member' c:/ruby/lib/ruby/1.8/test/unit/testcase.rb:78:insend
c:/ruby/lib/ruby/1.8/test/unit/testcase.rb:78:in run' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2-/lib/ active_support/testing/default.rb:7:inrun’
c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:34:in run' c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:ineach’
c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in run' c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:34:inrun’
c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in each' c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:inrun’
c:/ruby/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:46:in
run_suite' c:/ruby/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:67:instart_mediator’
c:/ruby/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:41:in
start' c:/ruby/lib/ruby/1.8/test/unit/ui/testrunnerutilities.rb:29:inrun’
c:/ruby/lib/ruby/1.8/test/unit/autorunner.rb:216:in run' c:/ruby/lib/ruby/1.8/test/unit/autorunner.rb:12:inrun’
c:/ruby/lib/ruby/1.8/test/unit.rb:278
member_list_controller_test.rb:202

What does this mean? Does it have to do with InstantRails, which I am
using?

By the way, here’s the code that I wrote:

Edit

<% form_for :person do |form| %> <%= form.label :person, :first_name, 'First name' %> <%= form.text_field :first_name, :size => 30 %> <%= form.label :person, :last_name, 'Last name' %> <%= form.text_field :last_name, :size => 30 %> <%= form.label :person, :rin, 'Rensselaer ID' %> <%= form.text_field :rin, :size => 10 %> <%= form.label :person, :email %> <%= form.text_field :email, :size => 30 %> <%= form.label :person, :year, 'Graduation Year' %> <%= form.select( :year, generate_year_array( @person.year ) ) %> <%= submit_tag "Edit!" %> <%end%>
------- ###-----test edit member-----#### def test_valid_edit_member person = Person.find(1) assert_equal person.first_name, 'Tommy' assert_equal person.last_name, 'Nook' assert_equal person.rin, 'nookt' assert_equal person.email, '[email protected]' post :edit_member, { :id => 1, :lang_url_id => 'en', :person => { :first_name => 'Jam', :last_name => 'Ojisan', :rin => 'ojisaj', :email => '[email protected]' } }, { :user_id => 5 } assert_response :redirect assert_redirected_to :controller => 'member_list', :action => 'list_members', :lang_url_id => 'en', :id => 0 person = Person.find(1) assert_equal person.first_name, 'Jam' assert_equal person.last_name, 'Ojisan' assert_equal person.rin, 'ojisaj' assert_equal person.email, '[email protected]' end ----- ######Controller class MemberListController < ApplicationController layout "member_list"

#use this to sign up, list all members, and delete members
#also for turning members to officer, admin, member,
#and changing passwords
before_filter :admin?,
:except => [:list_members, :update_password, :return_to_listing]
before_filter :officer?,
:only => [:list_members, :update_password]

verify :method => :post, :except => [ :list_members ],
:redirect_to => { :controller => ‘view’, :action => ‘view’,
:lang_url_id => ‘en’, :wiki_id => 1 }

#edit any member, including yourself
def edit_member
@person = Person.find( params[:id] )
if !params[:person]
render :action => ‘edit_member’
elsif @person.update_attributes( params[:person] )
return_to_listing #a private method that redirects to listing.
else
render :action => ‘edit_member’
end
end

There’s more to this, but it will take up too much space

end

#######Model
class Person < ActiveRecord::Base
#first_name is required: must start with a capital
validates_presence_of :first_name
validates_format_of :first_name,
:with => /^[A-Z][a-zA-Z0-9, .]+$/

#last_name is required: must start with a capital
validates_presence_of :last_name
validates_format_of :last_name,
:with => /^[A-Z][a-zA-Z0-9, .]+$/

#rin is required: must be unique; also, must all be lowercases
#with 0 to 2 numbers following the letters.
validates_presence_of :rin
validates_format_of :rin,
:with => /^[a-z]+[0-9]{0,2}$/
validates_uniqueness_of :rin

#email must be unique, and it is required.
validates_presence_of :email
validates_format_of :email,
:with => /^[a-zA-Z0-9_][email protected][a-zA-Z0-9_]+(.[a-z]{2,3}){1,2}$/
validates_uniqueness_of :email

#year is required, and must be a 4 digit number greater than 2000
validates_presence_of :year
validates_numericality_of :year,
:only_integer => true
validates_length_of :year,
:is => 4
end

My mistake, this is the test that was giving me this error:


def test_no_param_edit_member
post :edit_member, { :id => 1,
:lang_url_id => ‘en’ },
{ :user_id => 5 }
assert_response :success
assert_template ‘member_list/edit_member’
assert_no_nil assigns[‘person’]
assert_equal assigns[‘person’].first_name, ‘Tommy’
assert_equal assigns[‘person’].last_name, ‘Nook’
assert_equal assigns[‘person’].rin, ‘nookt’
assert_equal assigns[‘person’].email, ‘[email protected]
end

Nevermind, I forgot that Google is my friend =P