Philippe Lang wrote:
class Garden < ActiveRecord::Base set_primary_key :code end
garden = Garden.new("code" => 1, "name" => "garden1") garden.save
When you use set_primary_key, ActiveRecord maps your key to the attribute "id" behind the scenes. So you still use "id".
- Mark.
Let's see the problem differently: