Loading...

cfwheels@googlegroups.com

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: [cfwheels] Re: default values Mike Lester Wed Jun 30 18:01:10 2010

OK, I'll take a look at this when I get to the office tomorrow (no easy
MSSQL access for me from home).  If you are inclined to continue modifying
the plugin, I believe if you use:

<cfset set(overwritePlugins=false)>

..you should be able to mess with the plugin code without Wheels overwriting
it.



On Wed, Jun 30, 2010 at 6:10 PM, Joey <[EMAIL PROTECTED]> wrote:

> I just tried using it now, but having a few issues with a timestamp
> column.
>
> In my MSSQL db - I have a log table, id (pk), type, msg, timestamp
> (defaults to getDate()).
> In config/settings; <cfset set(functionName="new", defaults=true) />
> In my log model; <cfset
> set(timeStampOnUpdateProperty="PELogTimestamp") />
>
> params.log contains only; type, msg
> When I do <cfset log = model('PELogs').new(params.log) />
> I get [Macromedia][SQLServer JDBC Driver][SQLServer]Cannot insert the
> value NULL into column 'PELogTimestamp', table 'xxx.dbo.tbLPELogs';
> column does not allow nulls. INSERT fails.
>
> I debugged wheels/models/crud.cfc and found that it's trying to insert
> PELogTimestamp as '', if I toggle <cfset set(functionName="new",
> defaults=true) /> to false - I get the same error, but the insert
> statement doesn't try inserting PELogTimestamp.
>
> I think I found where it's going wrong... I only just now realised
> when I try modifying code in the plugins/blankdefaults.cfc that it
> resets :P (silly me)
>
> if(Len(variables.wheels.class.properties[loc.iItem].defaultValue))
> {
>        // set the default value from the db
>        this[loc.iItem] =
> variables.wheels.class.properties[loc.iItem].defaultValue;
> }
> else
> {
>        this[loc.iItem] = "";
> }
>
> On Jul 1, 7:04 am, Mike Lester <[EMAIL PROTECTED]> wrote:
> > Oops.  I just realized my documentation in the plugin is missing some
> > details!
> >
> > If you add the following to your config/settings.cfm:
> >
> > <cfset set(functionName="new", defaults=true)>
> >
> > The blank defaults should be created without having to make that explicit
> > call to $setDefaultValues.
> >
> >
> >
> > On Wed, Jun 30, 2010 at 3:48 PM, funaroma <[EMAIL PROTECTED]> wrote:
> > > So far it looks like it works, when I do:
> >
> > > product = model("Product").new();
> > > product.$setDefaultValues();
> >
> > > is this the intended use, or should that $method call go somewhere
> > > else?
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "ColdFusion on Wheels" group.
> > > To post to this group, send email to [EMAIL PROTECTED]
> > > To unsubscribe from this group, send email to
> > > [EMAIL PROTECTED]<[EMAIL PROTECTED]>
> <[EMAIL PROTECTED] om>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/cfwheels?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "ColdFusion on Wheels" group.
> To post to this group, send email to [EMAIL PROTECTED]
> To unsubscribe from this group, send email to
> [EMAIL PROTECTED]<[EMAIL PROTECTED]>
> .
> For more options, visit this group at
> http://groups.google.com/group/cfwheels?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"ColdFusion on Wheels" group.
To post to this group, send email to [EMAIL PROTECTED]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfwheels?hl=en.