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: <tr> 31: <td><label for "type">Type</label></br><%32: options = [["Select Program Type", ""]] + Placement::PROGRAM_TYPES 33: select("placement", "type", options) %> 34: </td> 35: <td></td> 36: <td> 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
''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. On 2/7/06, Craig White <craigwhite@azapple.com> wrote:> 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: <tr> > 31: <td><label for "type">Type</label></br><%> 32: options = [["Select Program Type", ""]] + > Placement::PROGRAM_TYPES > 33: select("placement", "type", options) %> > 34: </td> > 35: <td></td> > 36: <td> > > 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 > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
duh - gasp! always overlook the obvious is my motto. At least I typed it right. thanks Craig On Tue, 2006-02-07 at 17:02 -0500, Kent Sibilev wrote:> ''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. > > On 2/7/06, Craig White <craigwhite@azapple.com> wrote: > > 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: <tr> > > 31: <td><label for "type">Type</label></br><%> > 32: options = [["Select Program Type", ""]] + > > Placement::PROGRAM_TYPES > > 33: select("placement", "type", options) %> > > 34: </td> > > 35: <td></td> > > 36: <td> > > > > 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 > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
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 --- On 2/7/06, Craig White <craigwhite@azapple.com> wrote:> duh - gasp! always overlook the obvious is my motto. > > At least I typed it right. > > thanks > > Craig > > On Tue, 2006-02-07 at 17:02 -0500, Kent Sibilev wrote: > > ''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. > > > > On 2/7/06, Craig White <craigwhite@azapple.com> wrote: > > > 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: <tr> > > > 31: <td><label for "type">Type</label></br><%> > > 32: options = [["Select Program Type", ""]] + > > > Placement::PROGRAM_TYPES > > > 33: select("placement", "type", options) %> > > > 34: </td> > > > 35: <td></td> > > > 36: <td> > > > > > > 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 > > > > > > _______________________________________________ > > > Rails mailing list > > > Rails@lists.rubyonrails.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
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 On Wed, 2006-02-08 at 11:51 -0800, Rabbit wrote:> 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 > > --- > > On 2/7/06, Craig White <craigwhite@azapple.com> wrote: > > duh - gasp! always overlook the obvious is my motto. > > > > At least I typed it right. > > > > thanks > > > > Craig > > > > On Tue, 2006-02-07 at 17:02 -0500, Kent Sibilev wrote: > > > ''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. > > > > > > On 2/7/06, Craig White <craigwhite@azapple.com> wrote: > > > > 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: <tr> > > > > 31: <td><label for "type">Type</label></br><%> > > > 32: options = [["Select Program Type", ""]] + > > > > Placement::PROGRAM_TYPES > > > > 33: select("placement", "type", options) %> > > > > 34: </td> > > > > 35: <td></td> > > > > 36: <td> > > > > > > > > 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 > > > > > > > > _______________________________________________ > > > > Rails mailing list > > > > Rails@lists.rubyonrails.org > > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > _______________________________________________ > > > Rails mailing list > > > Rails@lists.rubyonrails.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
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. On 2/8/06, Craig White <craigwhite@azapple.com> wrote:> 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 > > On Wed, 2006-02-08 at 11:51 -0800, Rabbit wrote: > > 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 > > > > --- > > > > On 2/7/06, Craig White <craigwhite@azapple.com> wrote: > > > duh - gasp! always overlook the obvious is my motto. > > > > > > At least I typed it right. > > > > > > thanks > > > > > > Craig > > > > > > On Tue, 2006-02-07 at 17:02 -0500, Kent Sibilev wrote: > > > > ''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. > > > > > > > > On 2/7/06, Craig White <craigwhite@azapple.com> wrote: > > > > > 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: <tr> > > > > > 31: <td><label for "type">Type</label></br><%> > > > > 32: options = [["Select Program Type", ""]] + > > > > > Placement::PROGRAM_TYPES > > > > > 33: select("placement", "type", options) %> > > > > > 34: </td> > > > > > 35: <td></td> > > > > > 36: <td> > > > > > > > > > > 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 > > > > > > > > > > _______________________________________________ > > > > > Rails mailing list > > > > > Rails@lists.rubyonrails.org > > > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > _______________________________________________ > > > > Rails mailing list > > > > Rails@lists.rubyonrails.org > > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > _______________________________________________ > > > Rails mailing list > > > Rails@lists.rubyonrails.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
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 On Wed, 2006-02-08 at 15:28 -0500, Kent Sibilev wrote:> 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. > > On 2/8/06, Craig White <craigwhite@azapple.com> wrote: > > 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 > > > > On Wed, 2006-02-08 at 11:51 -0800, Rabbit wrote: > > > 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 > > > > > > --- > > > > > > On 2/7/06, Craig White <craigwhite@azapple.com> wrote: > > > > duh - gasp! always overlook the obvious is my motto. > > > > > > > > At least I typed it right. > > > > > > > > thanks > > > > > > > > Craig > > > > > > > > On Tue, 2006-02-07 at 17:02 -0500, Kent Sibilev wrote: > > > > > ''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. > > > > > > > > > > On 2/7/06, Craig White <craigwhite@azapple.com> wrote: > > > > > > 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: <tr> > > > > > > 31: <td><label for "type">Type</label></br><%> > > > > > 32: options = [["Select Program Type", ""]] + > > > > > > Placement::PROGRAM_TYPES > > > > > > 33: select("placement", "type", options) %> > > > > > > 34: </td> > > > > > > 35: <td></td> > > > > > > 36: <td> > > > > > > > > > > > > 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 > > > > > > > > > > > > _______________________________________________ > > > > > > Rails mailing list > > > > > > Rails@lists.rubyonrails.org > > > > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > _______________________________________________ > > > > > Rails mailing list > > > > > Rails@lists.rubyonrails.org > > > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > _______________________________________________ > > > > Rails mailing list > > > > Rails@lists.rubyonrails.org > > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > _______________________________________________ > > > Rails mailing list > > > Rails@lists.rubyonrails.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
I _want_ to use the type column''s special attributes. Maybe I can''t. Oh well. - Rabbit --- On 2/8/06, Craig White <craigwhite@azapple.com> wrote:> 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 > > On Wed, 2006-02-08 at 15:28 -0500, Kent Sibilev wrote: > > 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. > > > > On 2/8/06, Craig White <craigwhite@azapple.com> wrote: > > > 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 > > > > > > On Wed, 2006-02-08 at 11:51 -0800, Rabbit wrote: > > > > 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 > > > > > > > > --- > > > > > > > > On 2/7/06, Craig White <craigwhite@azapple.com> wrote: > > > > > duh - gasp! always overlook the obvious is my motto. > > > > > > > > > > At least I typed it right. > > > > > > > > > > thanks > > > > > > > > > > Craig > > > > > > > > > > On Tue, 2006-02-07 at 17:02 -0500, Kent Sibilev wrote: > > > > > > ''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. > > > > > > > > > > > > On 2/7/06, Craig White <craigwhite@azapple.com> wrote: > > > > > > > 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: <tr> > > > > > > > 31: <td><label for "type">Type</label></br><%> > > > > > > 32: options = [["Select Program Type", ""]] + > > > > > > > Placement::PROGRAM_TYPES > > > > > > > 33: select("placement", "type", options) %> > > > > > > > 34: </td> > > > > > > > 35: <td></td> > > > > > > > 36: <td> > > > > > > > > > > > > > > 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 > > > > > > > > > > > > > > _______________________________________________ > > > > > > > Rails mailing list > > > > > > > Rails@lists.rubyonrails.org > > > > > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > > > _______________________________________________ > > > > > > Rails mailing list > > > > > > Rails@lists.rubyonrails.org > > > > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > _______________________________________________ > > > > > Rails mailing list > > > > > Rails@lists.rubyonrails.org > > > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > _______________________________________________ > > > > Rails mailing list > > > > Rails@lists.rubyonrails.org > > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > _______________________________________________ > > > Rails mailing list > > > Rails@lists.rubyonrails.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >