chris.drappier
unread,Sep 9, 2009, 1:54:36 PM9/9/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Composite Keys for ActiveRecord
Hi All,
I have a legacy database that I'm trying to wrap in rails using active
scaffold. one of my models has a composite primary key, and I can't
get the controller to render the index. here's the code :
class Item < ActiveRecord::Base
set_primary_keys :pduid, :version
end
class ItemsController < ApplicationController
active_scaffold :items
end
ActionController::Routing::Routes.draw do |routes|
routes.with_options :active_scaffold => true do |map|
map.resources :items
end
end
the activescaffold plugin is installed, as is the
composite_primary_keys gem. I'm on rails 2.3.3, and here's the error I
get :
ArgumentError in ItemsController#index
Could not find column pduid,version
RAILS_ROOT: /storage/ccache-rails/trunk
/storage/ccache-rails/trunk/vendor/plugins/active_scaffold/lib/
active_scaffold/data_structures/sorting.rb:16:in `add'
/storage/ccache-rails/trunk/vendor/plugins/active_scaffold/lib/
active_scaffold/config/list.rb:14:in `initialize'
/storage/ccache-rails/trunk/vendor/plugins/active_scaffold/lib/
active_scaffold/config/core.rb:140:in `new'
/storage/ccache-rails/trunk/vendor/plugins/active_scaffold/lib/
active_scaffold/config/core.rb:140:in `method_missing'
/storage/ccache-rails/trunk/vendor/plugins/active_scaffold/lib/
active_scaffold/config/core.rb:124:in `send'
/storage/ccache-rails/trunk/vendor/plugins/active_scaffold/lib/
active_scaffold/config/core.rb:124:in `_load_action_columns'
/storage/ccache-rails/trunk/vendor/plugins/active_scaffold/lib/
active_scaffold/data_structures/actions.rb:20:in `each'
/storage/ccache-rails/trunk/vendor/plugins/active_scaffold/lib/
active_scaffold/data_structures/actions.rb:20:in `each'
/storage/ccache-rails/trunk/vendor/plugins/active_scaffold/lib/
active_scaffold/config/core.rb:123:in `_load_action_columns'
/storage/ccache-rails/trunk/vendor/plugins/active_scaffold/lib/
active_scaffold.rb:59:in `active_scaffold'
/storage/ccache-rails/trunk/app/controllers/items_controller.rb:2
I can't figure this one out.
plz halp!
-C