Stuck in Quickstart Tutorial

3 views
Skip to first unread message

Lola J. Lee Beno

unread,
Jun 1, 2011, 7:50:31 AM6/1/11
to col...@googlegroups.com
I'm going through the tutorial, and so far, so good, until I got to
"Adding a book" section. When I loaded
http://127.0.0.1/bookstore/public/index.cfm/book/add, I got this error
message:

The method new was not found in component
/Library/WebServer/Documents/bookstore/app/model/Book.cfc.

Ensure that the method is defined, and that it is spelled correctly.

The error occurred in
/Library/WebServer/Documents/bookstore/app/controllers/BookController.cfc:
line 8
Called from <generated>: line 1
Called from
/Library/WebServer/Documents/ColdMVC/app/util/RouteDispatcher.cfc: line 286
Called from
/Library/WebServer/Documents/ColdMVC/app/util/RouteDispatcher.cfc: line 249
Called from
/Library/WebServer/Documents/ColdMVC/app/util/RouteDispatcher.cfc: line 81
Called from <generated>: line 1
Called from
/Library/WebServer/Documents/ColdMVC/app/util/EventDispatcher.cfc: line 106
Called from /Library/WebServer/Documents/ColdMVC/index.cfm: line 2
Called from /Library/WebServer/Documents/bookstore/public/index.cfm: line 1
6 : {
7 : function add() {
8 : params.book = _Book.new();
9 : }
10 : }


In BookController.cfc, this is what I have:

/**
* @extends coldmvc.Controller
*/

component
{
function add() {
params.book = _Book.new();
}
}

And in add.cfm:

<cfoutput>
<c:form action="save" bind="book">
<c:input name="title" />
<c:input name="author" />
<c:textarea name="description" />
<c:submit label="Add Book" />
<a href="#linkTo({action='list'})#">Back to List</a>
</c:form>
</cfoutput>

Where is the method new supposed to be defined?

--
Lola J. Lee Beno
LinkedIn: http://www.linkedin.com/in/lolajleebeno
Facebook: http://www.facebook.com/profile.php?id=714355583
Blog: http://www.lolajl.net/blog/

Tony Nelson

unread,
Jun 1, 2011, 8:38:41 AM6/1/11
to col...@googlegroups.com
Can you verify that your /app/model/Book.cfc extends coldmvc.Model?


-Tony

Lola J. Lee Beno

unread,
Jun 1, 2011, 8:58:42 AM6/1/11
to col...@googlegroups.com
On 6/1/11 8:38 AM, Tony Nelson wrote:
> Can you verify that your /app/model/Book.cfc extends coldmvc.Model?
>
>

Yes . . . I was able to create the table in the database so Book.cfc is
working. This is what I have:

/**
* @persistent true
* extends coldmvc.Model
*/

component
{
/**
* @fieldtype id
* @generator increment
*/

property id;
property title;
property author;
property description;

Dan Vega

unread,
Jun 1, 2011, 9:00:19 AM6/1/11
to col...@googlegroups.com
That is wrong... you need to use the @ symbol for annotations 

Right 

/**
 * @persistent true
 * @extends coldmvc.Model
 */

component {

}

Wrong
/**
 * @persistent true
 * extends coldmvc.Model
 */

component {

}

Tony Nelson

unread,
Jun 1, 2011, 9:02:32 AM6/1/11
to col...@googlegroups.com
It looks like you're missing the @ in front of extends.

If you're not a fan of the Javadoc comments, you could always have the following instead:

component persistent="true" extends="coldmvc.Model" {

}

-Tony

Lola J. Lee Beno

unread,
Jun 1, 2011, 9:03:16 AM6/1/11
to col...@googlegroups.com
Ohhh, doh!  Thanks!
Reply all
Reply to author
Forward
0 new messages