There is a plugin that helps with composite primary keys but it's a rails failing, not an active scaffold one. Active Scaffold also likes to deal with single id fields. The easiest way to fix is if you can alter the database to add a single identity column, which shouldn't break anything else. Sorry, it's a rails 'opinionated software' thing.
-Mike Chris Drappier wrote: > 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 > | > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "ActiveScaffold : Ruby on Rails plugin" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/activescaffold?hl=en -~----------~----~----~----~------~----~------~--~---
