ActionController::RoutingError after using scaffold

Hey there,

I'm new to Ruby and was following a tutorial found here:

http://stackoverflow.com/questions/545951/ruby-on-rails-link-to-syntax

Anyway, I already had my own MySQL database from PHP development so I
decided to try to create a scaffold off of a table 'users'.

I get the following error:
ActionController::RoutingError in Users#index

Showing app/views/users/index.html.erb where line #9 raised:

user_url failed to generate from {:controller=>"users", :action=>"show",
:id=>#<...>}

The issue is coming from this line:
<%= link_to 'Show', user %>

I tried deleting that code and trying this instead:
<%= user["user_id"] %> -- where user_id is a field in the users table
and it printed the user_id

Is this a known scaffold bug in Ruby installs on Windows? How do I go
about fixing it?

Thanks,
Lang

My guess is that you havent specified what the primary_key of the
users table is. Rails expect it do be "id" if you dont specify it.
Try adding "set_primary_key(:user_id)" to your user model if you
havent already.

Sharagoz wrote:

My guess is that you havent specified what the primary_key of the
users table is. Rails expect it do be "id" if you dont specify it.
Try adding "set_primary_key(:user_id)" to your user model if you
havent already.

That fixed it! Thanks so much!