# Select list error - following Agile guide

**URL:** <https://www.ruby-forum.com/t/select-list-error-following-agile-guide/53507>\
**Category:** Rails\
**Created:** [February 7, 2006, 10:52pm UTC](https://www.ruby-forum.com/t/select-list-error-following-agile-guide/53507 "2006-02-07T22:52:32Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [February 7, 2006, 10:52pm UTC](https://www.ruby-forum.com/t/select-list-error-following-agile-guide/53507/1 "2006-02-07T22:52:32Z")

</div>

I would swear that I am tracking exactly the method used in Agile  
book…

TypeError in Placements#edit  
Showing app/views/placements/\_form.rhtml where line #33 raised:

wrong argument type String (expected Module)

Extracted source (around line #33):

30:

  
31: \<label for “type”\>Type\<%=  
32: options = [[“Select Program Type”, “”]] +  
Placement::PROGRAM\_TYPES  
33: select(“placement”, “type”, options) %\>  
34:   
35:   
36: 

inside of placement.rb (model)

PROGRAM\_TYPES = [  
[“PAH”, “PAH”],  
[“16 Hour”, “16 Hour”],  
[“24 Hour”, “24 Hour”],  
[“24 Hour DD”, “24 Hour DD”]  
].freeze

Why isn’t this working?

Craig

---

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [February 7, 2006, 11:04pm UTC](https://www.ruby-forum.com/t/select-list-error-following-agile-guide/53507/2 "2006-02-07T23:04:44Z")

</div>

‘type’ attribute is reserved for STI (single table inheritance). Try  
to change the name of this attribute from ‘type’ to something else and  
check whether it helps.

Kent.

---

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [February 7, 2006, 11:16pm UTC](https://www.ruby-forum.com/t/select-list-error-following-agile-guide/53507/3 "2006-02-07T23:16:53Z")

</div>

duh - gasp! always overlook the obvious is my motto.

At least I typed it right.

thanks

Craig

---

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [February 8, 2006, 8:52pm UTC](https://www.ruby-forum.com/t/select-list-error-following-agile-guide/53507/4 "2006-02-08T20:52:36Z")

</div>

Yes, “type” is meant for use with STI, but, right now I’m having  
similar trouble.

My table, advertisers, uses the special “type” field. I want users to  
be able to select the type of advertiser during creation via a select  
box. Is this possible? (I assume it would be possible using  
select\_tag(), but I’d rather use select().)

The types of advertisers are stored as string in an array in  
environment.rb. The code I’m using works fine - I’ve tested it in  
console.rb. But here it is anyway…

\<%= select ‘advertiser’, ‘type’, ADVERTISERS.map { |at| [at, at] } %\>

Has anyone else run into this problem? Is it possible to use the  
“type” field like this?

- Rabbit

* * *

---

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [February 8, 2006, 9:29pm UTC](https://www.ruby-forum.com/t/select-list-error-following-agile-guide/53507/5 "2006-02-08T21:29:12Z")

</div>

Actually, you can change the default name of this column from ‘type’  
to something else by overriding the inheritance\_column method of the  
ActiveRecord::Base class.

Kent.

---

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [February 8, 2006, 9:20pm UTC](https://www.ruby-forum.com/t/select-list-error-following-agile-guide/53507/6 "2006-02-08T21:20:16Z")

</div>

Since it’s a reserved name, you are always gonna struggle with using a  
table with a column named ‘type’ - that was what I gathered and so I  
simply renamed the column and moved on.

as for a selection list of values…this has worked for me…

\<%= options = [[‘Select Type’, ‘’]] + model::METHOD, select  
‘controller’, ‘field’, options %\>

ie…my model and controller being ‘placement’ and my METHOD being a  
list of values in the placement model called “PROGRAM\_TYPES”…

\<%= options = [[‘Select Type’, ‘’]] + placement::PROGRAM\_TYPES select  
‘placement’, ‘pltype’, options %\>

Craig

---

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [February 8, 2006, 10:34pm UTC](https://www.ruby-forum.com/t/select-list-error-following-agile-guide/53507/7 "2006-02-08T22:34:49Z")

</div>

I _want_ to use the type column’s special attributes. Maybe I can’t.

Oh well.

- Rabbit

* * *

---

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [February 8, 2006, 9:41pm UTC](https://www.ruby-forum.com/t/select-list-error-following-agile-guide/53507/8 "2006-02-08T21:41:23Z")

</div>

yeah but it was a part of a bunch of new tables tossed together without  
any meaningful data or significant amount of coding (since the amount of  
coding I have gotten done is directly proportionate to my lack of  
knowledge which inch by inch grows and in another 5 years…I think I  
will understand things). If it were an existing table with data, I might  
have opted for that but it did seem to me when that was first brought up  
that I needed to bail on the column name ‘type’ since seemed to be the  
type of thing that would aggravate me forever in a million different  
ways…including outside of the ruby/rails environment.

😉

Thanks

Craig
