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:in `form_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:in `send''
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:in `render_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:in `render_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:in `render_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:in `render''
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:in `render''
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:in `send''
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:in `call_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:in
`perform_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:in
`perform_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:in `perform_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:in `cache''
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:in `send''
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:in
`process_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:in `process''
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:in `post''
member_list_controller_test.rb:203:in `test_no_param_edit_member''
c:/ruby/lib/ruby/1.8/test/unit/testcase.rb:78:in `__send__''
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:in `run''
c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run''
c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each''
c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run''
c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run''
c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each''
c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run''
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:in
`start_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:in
`run''
c:/ruby/lib/ruby/1.8/test/unit/autorunner.rb:216:in `run''
c:/ruby/lib/ruby/1.8/test/unit/autorunner.rb:12:in `run''
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:
---------
<!-- view form I''m testing ---->
<h1>
Edit
</h1>
<div id="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%>
</div>
-------
###-----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,
''nookt-IL7dBOYR4Vg@public.gmane.org''
post :edit_member, { :id => 1,
:lang_url_id => ''en'',
:person => {
:first_name => ''Jam'',
:last_name => ''Ojisan'',
:rin => ''ojisaj'',
:email => ''ojisaj-IL7dBOYR4Vg@public.gmane.org'' }
}, { :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,
''ojisaj-IL7dBOYR4Vg@public.gmane.org''
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_]+@[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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
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,
''nookt-IL7dBOYR4Vg@public.gmane.org''
end
On Jun 3, 8:33 pm, Taro
<japtar10...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> 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:in `form_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:in `send''
> 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:in `render_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:in `render_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:in `render_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:in `render''
> 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:in `render''
> 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:in `send''
> 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:in `call_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:in
> `perform_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:in
> `perform_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:in `perform_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:in `cache''
> 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:in `send''
> 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:in
> `process_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:in `process''
> 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:in `post''
> member_list_controller_test.rb:203:in
`test_no_param_edit_member''
> c:/ruby/lib/ruby/1.8/test/unit/testcase.rb:78:in `__send__''
> 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:in `run''
> c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run''
> c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each''
> c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run''
> c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run''
> c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each''
> c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run''
> 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:in
> `start_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:in
> `run''
> c:/ruby/lib/ruby/1.8/test/unit/autorunner.rb:216:in `run''
> c:/ruby/lib/ruby/1.8/test/unit/autorunner.rb:12:in `run''
> 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:
> ---------
> <!-- view form I''m testing ---->
> <h1>
> Edit
> </h1>
> <div id="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%>
> </div>
> -------
> ###-----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,
''no...-IL7dBOYR4Vg@public.gmane.org''
> post :edit_member, { :id => 1,
> :lang_url_id => ''en'',
> :person => {
> :first_name => ''Jam'',
> :last_name => ''Ojisan'',
> :rin => ''ojisaj'',
> :email =>
''oji...-IL7dBOYR4Vg@public.gmane.org'' }
> }, { :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,
''oji...-IL7dBOYR4Vg@public.gmane.org''
> 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_]+@[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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Nevermind, I forgot that Google is my friend =P On Jun 3, 8:37 pm, Taro <japtar10...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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, ''no...-IL7dBOYR4Vg@public.gmane.org'' > end > > On Jun 3, 8:33 pm, Taro <japtar10...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > 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:in `form_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:in `send'' > > 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:in `render_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:in `render_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:in `render_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:in `render'' > > 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:in `render'' > > 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:in `send'' > > 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:in `call_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:in > > `perform_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:in > > `perform_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:in `perform_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:in `cache'' > > 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:in `send'' > > 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:in > > `process_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:in `process'' > > 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:in `post'' > > member_list_controller_test.rb:203:in `test_no_param_edit_member'' > > c:/ruby/lib/ruby/1.8/test/unit/testcase.rb:78:in `__send__'' > > 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:in `run'' > > c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'' > > c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'' > > c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'' > > c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'' > > c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'' > > c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'' > > 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:in > > `start_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:in > > `run'' > > c:/ruby/lib/ruby/1.8/test/unit/autorunner.rb:216:in `run'' > > c:/ruby/lib/ruby/1.8/test/unit/autorunner.rb:12:in `run'' > > 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: > > --------- > > <!-- view form I''m testing ----> > > <h1> > > Edit > > </h1> > > <div id="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%> > > </div> > > ------- > > ###-----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, ''no...-IL7dBOYR4Vg@public.gmane.org'' > > post :edit_member, { :id => 1, > > :lang_url_id => ''en'', > > :person => { > > :first_name => ''Jam'', > > :last_name => ''Ojisan'', > > :rin => ''ojisaj'', > > :email => ''oji...-IL7dBOYR4Vg@public.gmane.org'' } > > }, { :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, ''oji...-IL7dBOYR4Vg@public.gmane.org'' > > 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, > > ... > > read more ยป--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---