ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button
Subject:   NoMethodError in Recipe#list
Date:   2007-04-13 19:41:24
From:   RRS2007
Response to: NoMethodError in Recipe#list

The reason is you did not put " Autoincrement" for the id column in the recipe table. You can try this sql query below:

drop table if exists recipes;
drop table if exists categories;
create table categories (
id int not null auto_increment,
name varchar(100) not null default '',
primary key(id)
) engine=InnoDB;

create table recipes (
id int not null auto_increment,
category_id int not null,
title varchar(100) not null default '',
description varchar(255) null,
date date null,
instructions text null,
constraint fk_recipes_categories foreign key (category_id) references categories(id),
primary key(id)
) engine=InnoDB;

It will create both Recipe and Catagory tables and will drop if you had them previously.

1 to 1 of 1
  1. NoMethodError in Recipe#list
    2007-04-13 20:08:06  RRS2007 [View]

    • NoMethodError in Recipe#list
      2009-04-08 07:32:23  yoberi [View]

    • NoMethodError in Recipe#list
      2009-04-08 07:08:08  yoberi [View]

1 to 1 of 1