Craig White
2006-Jun-12 22:18 UTC
[Rails] struggling with relatively simple out of model updating
I''m trying to do a In/Out thing... In my in_outs_controller.rb def edit_in_out @in_out = InOut.new @in_out.user_id = params[:id] @user = User.find_by_id(@in_out.user_id) if @in_out.save @user.update_attribute(:in_out, params[:user][:in_out]) flash[:notice] = ''In/Out was successfully updated.'' redirect_to :action => ''list'' else render :action => ''edit_io'' end end The error I get is... ActiveRecord::AssociationTypeMismatch InOut expected, got String Request Parameters: {"user"=>{"will_return"=>"", "in_out"=>"In"}, "commit"=>" Save ", "id"=>"19"} Users table has add_column :users, :in_out, :string, :limit => 3 add_column :users, :will_return, :string, :limit => 48 How can I do this? Craig