English 中文(简体)
CFWheels - 记录未插入
原标题:CFWheels - Record not being inserted

I m New to CFWheels and framework in general.

I m following the screencasts on the Wheels website: http://cfwheels.org/screencasts/

我的座右铭与......唯一的区别是,他的桌子被称作“人民”,地雷被称为“使用者”。 因此,我做了改动,但一切照旧。

他的单体是“人”,地雷是“用户”。

这里的“User.cfc”控制器插入代码:

<cfcomponent extends="Controller" output="true">

    <cffunction name="register">

        <cfset user = model("user").new() />

    </cffunction>

    <cffunction name="create">

        <cfset params.user[ userUUID ] = createUUID() />
        <cfset params.user[ userCreated ] = createODBCDateTime(now()) />
        <cfset params.user[ userModified ] = createODBCDateTime(now()) />

        <cfset user = model("user").new(params.user) />
        <cfset user.save() />

    </cffunction>

</cfcomponent>

Now, I m also using the form helpers etc in my view like so:

<cfparam name="user" />

<cfoutput>

#startFormTag( action="create" )#

<fieldset>

    <legend>Register</legend>

    #textField( label="User Name http://#cgi.server_name#/user/", objectName="user", property="userName" )#
    #textField( label="Email Address", objectName="user", property="userEmail" )#
    #textField( label="Password", objectName="user", property="userPassword" )#
    #submitTag( value="Register" )#

</fieldset>

#endFormTag()#

</cfoutput>

Pretty simple right? So I can t understand why it isn t inserting. Does it have something to do with naming my CFC "user" and also having a table called "users" with my singular name set as "user"?

当我提交表格时,没有错误。 它只执行罚款,但是如果我看在非行,就没有。

One thing I thought...is...exactly HOW does wheels even know what Table to look for? There doesn t seem to be any explanation for this. Perhaps it just locates the wrong table?

Many thanks, Michael


缩略语

每个人,只能向可能进入这一阶段的其他人提供最新情况。 之所以没有发生,是因为我的数据库表REQUIRED某些领域没有取消。 CFWheels被推倒任何错误。 一旦我把这些价值观传给这些领域,那是很不错的。

希望会有所帮助。

问题回答

迈克尔,首先,我可能建议你将控制器改名为用户。

在轮式(和铁路和其他类似的公约对配置框架)中,模型为单体(User.cfc),而控制器和表格为复数(Users.cfc)。 你的法典看上去是坚实的,在我身上跳出的唯一东西是,你的控制者被称作“User.cfc”。

我在创造/更新控制人员的方法中可以做的一件事就是这样:

if (user.save()){
    flashInsert(success="The user was created successfully.");
    redirectTo(action="index");
} else {
    flashInsert(error="There was an error creating the user.");
    renderPage(action="new");
}

用户将回馈一个豆类的值,这一条件使你能够做某些实际错误处理/调查,如果事情错了,而储蓄失败的话。

关于轮班如何了解轮轮椅的提问,轮班通过公约这样做。 [说明如何在此开展工作] 它检查了你的模型,并将检查每个模型中是否存在多元版本。 因此,如果有一个称为“User”的模式,那么轮式会预期会有一个称为“Users”的表格。

Michael,

我在排除示范物体功能方面迈出的第一步通常是放弃所有错误方法的结果。 在你试图节省费用之后添加这条线。

<cfdump var=user.allErrors() label="User Save Errors" abort />

MC





相关问题
JQuery AJAX .load - flash chart doesnt load in IE

An IE issue has me completely stumped. I have a coldfusion page that uses JQuery s AJAX .load function to load in a new flash file that is generated by coldFusion s cfchart tag. This works completely ...

Best Coldfusion Library for OpenID [closed]

I am getting ready to start a project that requires using OpenID within Coldfusion 8. I have found a number of different options and was wondering what has worked the best, get s the most support, ...

Find ColdFusion Generated ID

Is there a way to find the elements generated by ColdFusion s <CFLayout> and <CFLayoutArea> tags? These tags: <cflayout type="tab" name="MyAccount"> <cflayoutarea name="...

ColdFusion COM error

I am upgrading from CF4.5 to CF8. Calls to COM dll s that used to work in version 4.5 now throw a "Complex object types cannot be converted to simple values.." error. The COM object has a few arrays ...

What s the best way to write engine-specific CFML code?

Sometimes it is necessary to write different code for Adobe ColdFusion vs Railo vs OpenBD, due to differences in implementation. Do people have a specific method that they use for this? For example, ...

热门标签