A column named 'type'

I have a column in my table ‘activities’ called ‘type’ such that
activities.type=activitytypes.id. Having a column named ‘type,’ causes
errors the workaround which is included in the following model files
for these two models. I am using the scaffolding_extensions plugin btw.

I can do anything on an activitytype (add, delete, edit…) However,
when I go to do something, say, edit, an activity.I get the error
listed below the models, below. Can anyone enlighten me as to what I am
missing here to get past this error? (And yes, it’s a legacy db and I
cannot alter the column or table names) -Ralph

class Activity < ActiveRecord::Base

belongs_to :activitytype, :foreign_key => ‘type’

#add the following because I get the error:
#This error is raised because the column ‘type’ is reserved for
storing the class in case of inheritance. Please rename this column if
you didn’t intend it to be used for storing the inheritance class or
overwrite Activitytype.inheritance_column to use another column for
that information.

def self.inheritance_column
“rails_type”
end

end

class Activitytype < ActiveRecord::Base

has_many :activities, :foreign_key => ‘type’

#add the following because I get the error:
#The single-table inheritance mechanism failed to locate the
subclass: ‘letter’. This error is raised because the column ‘type’ is
reserved for storing the class in case of inheritance. Please rename
this column if you didn’t intend it to be used for storing the
inheritance class or overwrite Activitytype.inheritance_column to use
another column for that information.

def self.inheritance_column
“rails_type”
end

end

TypeError in Crud#edit_activity

Showing vendor/plugins/scaffolding_extensions/scaffolds/edit.rhtml
where line #3 raised:

wrong argument type Fixnum (expected Module)

Extracted source (around line #3):

1:

Editing <%= @scaffold_singular_name.humanize.downcase %>


2:
3: <%= scaffold_form(‘update’,
:fields=>@scaffold_class.scaffold_edit_fields) %>
4:
5: <%= association_links %>
6:

RAILS_ROOT: C:/INSTAN~2/rails_apps/ggrip/config/…
Application Trace | Framework Trace | Full Trace

C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/helpers/form_options_helper.rb:116:in
include?' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/helpers/form_options_helper.rb:116:inoptions_for_select’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/helpers/form_helper.rb:333:in
inject' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/helpers/form_options_helper.rb:114:ineach’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/helpers/form_options_helper.rb:114:in
inject' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/helpers/form_options_helper.rb:114:inoptions_for_select’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/helpers/form_options_helper.rb:303:in
to_select_tag' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/helpers/form_options_helper.rb:66:inselect’
#{RAILS_ROOT}/vendor/plugins/scaffolding_extensions/lib/scaffolding_extensions.rb:411:in
association_select_tag' #{RAILS_ROOT}/vendor/plugins/scaffolding_extensions/lib/scaffolding_extensions.rb:391:indefault_input_block’
#{RAILS_ROOT}/vendor/plugins/scaffolding_extensions/lib/scaffolding_extensions.rb:378:in
call' #{RAILS_ROOT}/vendor/plugins/scaffolding_extensions/lib/scaffolding_extensions.rb:378:inall_input_tags’
#{RAILS_ROOT}/vendor/plugins/scaffolding_extensions/lib/scaffolding_extensions.rb:375:in
collect' #{RAILS_ROOT}/vendor/plugins/scaffolding_extensions/lib/scaffolding_extensions.rb:375:inall_input_tags’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/helpers/active_record_helper.rb:70:in
form' #{RAILS_ROOT}/vendor/plugins/scaffolding_extensions/lib/scaffolding_extensions.rb:528:inscaffold_form’
#{RAILS_ROOT}/vendor/plugins/scaffolding_extensions/scaffolds/edit.rhtml:3:in
_run_rhtml_C__INSTAN1262_rails_apps_ggrip_vendor_plugins_scaffolding_extensions_scaffolds_edit' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:316:insend’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:316:in
compile_and_render_template' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:292:inrender_template’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:251:in
render_file' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:726:inrender_file’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:661:in
render_with_no_layout' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/layout.rb:253:inrender_without_benchmark’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:53:in
render' C:/INSTAN~2/ruby/lib/ruby/1.8/benchmark.rb:293:inmeasure’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:53:in
render' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:704:inrender_to_string’
#{RAILS_ROOT}/vendor/plugins/scaffolding_extensions/lib/scaffolding_extensions.rb:626:in
render_scaffold_template' #{RAILS_ROOT}/vendor/plugins/scaffolding_extensions/lib/scaffolding_extensions.rb:1104:inrender_activity_scaffold’
#{RAILS_ROOT}/vendor/plugins/scaffolding_extensions/lib/scaffolding_extensions.rb:975:in
edit_activity' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:941:insend’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:941:in
perform_action_without_filters' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:368:inperform_action_without_benchmark’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in
perform_action_without_rescue' C:/INSTAN~2/ruby/lib/ruby/1.8/benchmark.rb:293:inmeasure’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in
perform_action_without_rescue' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/rescue.rb:82:inperform_action’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in
send' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:inprocess_without_filters’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:377:in
process_without_session_management_support' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/session_management.rb:117:inprocess’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:38:in
dispatch' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel/rails.rb:73:inprocess’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:551:in
process_client' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:550:ineach’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:550:in
process_client' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:636:inrun’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:636:in
initialize' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:636:innew’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:636:in
run' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:625:ininitialize’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:625:in
new' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:625:inrun’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:956:in
run' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:955:ineach’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:955:in
run' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/bin/mongrel_rails:127:inrun’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel/command.rb:199:in
run' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/bin/mongrel_rails:235 C:/INSTAN~2/ruby/bin/mongrel_rails:18:inload’
C:/INSTAN~2/ruby/bin/mongrel_rails:18

C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/helpers/form_options_helper.rb:116:in
include?' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/helpers/form_options_helper.rb:116:inoptions_for_select’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/helpers/form_helper.rb:333:in
inject' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/helpers/form_options_helper.rb:114:ineach’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/helpers/form_options_helper.rb:114:in
inject' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/helpers/form_options_helper.rb:114:inoptions_for_select’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/helpers/form_options_helper.rb:303:in
to_select_tag' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/helpers/form_options_helper.rb:66:inselect’
#{RAILS_ROOT}/vendor/plugins/scaffolding_extensions/lib/scaffolding_extensions.rb:411:in
association_select_tag' #{RAILS_ROOT}/vendor/plugins/scaffolding_extensions/lib/scaffolding_extensions.rb:391:indefault_input_block’
#{RAILS_ROOT}/vendor/plugins/scaffolding_extensions/lib/scaffolding_extensions.rb:378:in
call' #{RAILS_ROOT}/vendor/plugins/scaffolding_extensions/lib/scaffolding_extensions.rb:378:inall_input_tags’
#{RAILS_ROOT}/vendor/plugins/scaffolding_extensions/lib/scaffolding_extensions.rb:375:in
collect' #{RAILS_ROOT}/vendor/plugins/scaffolding_extensions/lib/scaffolding_extensions.rb:375:inall_input_tags’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/helpers/active_record_helper.rb:70:in
form' #{RAILS_ROOT}/vendor/plugins/scaffolding_extensions/lib/scaffolding_extensions.rb:528:inscaffold_form’
#{RAILS_ROOT}/vendor/plugins/scaffolding_extensions/scaffolds/edit.rhtml:3:in
_run_rhtml_C__INSTAN1262_rails_apps_ggrip_vendor_plugins_scaffolding_extensions_scaffolds_edit' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:316:insend’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:316:in
compile_and_render_template' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:292:inrender_template’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:251:in
render_file' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:726:inrender_file’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:661:in
render_with_no_layout' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/layout.rb:253:inrender_without_benchmark’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:53:in
render' C:/INSTAN~2/ruby/lib/ruby/1.8/benchmark.rb:293:inmeasure’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:53:in
render' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:704:inrender_to_string’
#{RAILS_ROOT}/vendor/plugins/scaffolding_extensions/lib/scaffolding_extensions.rb:626:in
render_scaffold_template' #{RAILS_ROOT}/vendor/plugins/scaffolding_extensions/lib/scaffolding_extensions.rb:1104:inrender_activity_scaffold’
#{RAILS_ROOT}/vendor/plugins/scaffolding_extensions/lib/scaffolding_extensions.rb:975:in
edit_activity' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:941:insend’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:941:in
perform_action_without_filters' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:368:inperform_action_without_benchmark’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in
perform_action_without_rescue' C:/INSTAN~2/ruby/lib/ruby/1.8/benchmark.rb:293:inmeasure’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in
perform_action_without_rescue' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/rescue.rb:82:inperform_action’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in
send' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:inprocess_without_filters’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:377:in
process_without_session_management_support' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/session_management.rb:117:inprocess’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:38:in
dispatch' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel/rails.rb:73:inprocess’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:551:in
process_client' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:550:ineach’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:550:in
process_client' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:636:inrun’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:636:in
initialize' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:636:innew’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:636:in
run' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:625:ininitialize’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:625:in
new' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:625:inrun’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:956:in
run' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:955:ineach’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel.rb:955:in
run' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/bin/mongrel_rails:127:inrun’
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel/command.rb:199:in
run' C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/bin/mongrel_rails:235 C:/INSTAN~2/ruby/bin/mongrel_rails:18:inload’
C:/INSTAN~2/ruby/bin/mongrel_rails:18

Request

Parameters: {“id”=>“1”}

Show session dump


flash: !map:ActionController::Flash::FlashHash {}

Response
Headers: {“cookie”=>[], “Cache-Control”=>“no-cache”}

Whoops…I see why. I had a blob type column in activities. When I
specified, in the activity model,
def self.scaffold_fields
[…whatever fields, just NOT the blob field]
end

everything is happy. -Ralph