probably a stupid rails question

Discussion in 'Ruby' started by tsuraan, Aug 26, 2005.

  1. tsuraan

    tsuraan Guest

    I'm working through the Rails intro on
    http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html, and having a
    bit of a problem with the part on page three, where you add a recipe
    to the database. My recipes table (in Postgresql) looks like this:

    <pre>
    Table "public.recipes"
    Column | Type | Modifiers=20
    --------------+------------------------+-----------
    id | integer | not null
    title | character varying(255) | not null
    description | character varying(255) |=20
    date | date |=20
    instructions | text |=20
    Indexes:
    "recipes_pkey" PRIMARY KEY, btree (id)
    </pre>

    When I go to add an entry using the Rails structure, I get the following er=
    ror:
    So, it's looking like Rails isn't properly handling the primary key
    constraint on the table. Is rails supposed to do this, or should I
    ditch the primary key in the database? I don't know much about
    databases or about rails, so I'm probably missing something really
    obvious. Any ideas?
     
    tsuraan, Aug 26, 2005
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.