Skip to content

Instantly share code, notes, and snippets.

@radar
Forked from anonymous/gist:2621
Created July 26, 2008 08:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radar/2622 to your computer and use it in GitHub Desktop.
Save radar/2622 to your computer and use it in GitHub Desktop.
## /users/edit.html.erb
<% form_for [:cp, @user], :url => { :action => 'update', :id => @user.id } do |f| %>
...
<%= collection_select :users, :show_id, Show.find(:all), :id, :name, { :prompt => true } %>
## users_controller.rb
@user.shows << Show.find(params[:users][:show_id])
## error
ActiveRecord::AssociationTypeMismatch in Cp/usersController#update
Show(#28733190) expected, got String(#104960)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment