I have a model with a user primary key:
document.rb
class Document < ActiveRecord::Base
set_primary_key "token"
end
routes.rb:
MyApp::Application.routes.draw do
resources :documents, :only => [:index, :show, :create]
end
When I create a new document, I get an error message:
No route matches {:controller=>"documents", :id=>
When I switch to using: id as the primary key, everything is fine. But I need to use a token.
I use: rails 3.0.0 and ruby 1.8.7 (2010-04-19 patchlevel 253) [i686-linux], MBARI 0x8770, Ruby Enterprise Edition 2010.02
Thanks for the help.
source
share