I just posted an issue for this:
http://github.com/russjohnson/SplashCMS/issues/issue/46
There is a conflict with the 'name' field in the user object.
If you dump the user object, you'll see the name field, but it contains the value of the 'username'. I think there must be a conflict in Wheels where it gets confused. If you rename the 'name' field to 'fullname' the problem goes away.
Another place you can see this in action is on the Users/Edit screen in the admin. It doesn't pull in the 'name' information, but instead pulls the 'username'.
What do you guys think about change ‘name’ to ‘fullname’ everywhere in Splash?
Office:
770-642-1353
eMail: cbi...@resultantsys.com
This may be a conflict with something unscoped on Wheels... I am
pretty sure it should be conflicting with arguments.name in models or
something... can you log this into cfwheels issue page as well?
> eMail: cbis...@resultantsys.com
In this case, there are two fields in the user table:
username
name
When Wheels retrieves the data, both fields contain the same data which is pulled from the username field.
I did try author(select=’name’) and that worked! So that give me a workaround for now.
In the Admin, the User-Edit function isn’t working right either due to the same problem. So, I think this is a Splash bug, and not a Wheels bug. Right?
Clarke
If I remember correctly, the code that was responsible is in the
$initModelObject method in wheels/model/crud.cfm. When it converts a
query row into an object, it can populate the value of one property
with the value of another. Here's the code (I hope it doesn't wrap
too poorly):
if (ListFindNoCase(arguments.properties.columnList, arguments.name
& loc.iItem))
this[loc.iItem] = arguments.properties[arguments.name &
loc.iItem][arguments.row];
else if (ListFindNoCase(arguments.properties.columnList,
loc.iItem))
this[loc.iItem] = arguments.properties[loc.iItem]
[arguments.row];
The first 'if' statement concatenates the name of the model and the
property name, so it will assign the value of 'username' to the 'name'
property.
This seems like a problem, because an object returned by findByKey()
won't necessarily contain the same values in a one-row query result
from findAllByXXX().
-Doug
On Mar 11, 12:39 pm, Russ Johnson <russ.cfco...@gmail.com> wrote:
> I have been noticing this myself and even spent some time trying to figure out why but just started to ignore it after awhile... I think now that I understand the problem so I will look at a code fix for it shortly..
>
> - Russ
>
> On Mar 9, 2010, at 2:38 PM, Clarke Bishop wrote:
>
> > In this case, there are two fields in the user table:
> > username
> > name
>
> > When Wheels retrieves the data, both fields contain the same data which is pulled from the username field.
>
> > I did try author(select=’name’) and that worked! So that give me a workaround for now.
>
> > In the Admin, the User-Edit function isn’t working right either due to the same problem. So, I think this is a Splash bug, and not a Wheels bug. Right?
>
> > Clarke
>
> > From: spla...@googlegroups.com [mailto:spla...@googlegroups.com] On Behalf Of Chris Peters
> > Sent: Tuesday, March 09, 2010 1:40 PM
> > To: spla...@googlegroups.com
> > Subject: Re: [splashcms] Re: The User object 'name' field
>
> > When there are naming collisions, Wheels appends the children column names with the included table's name. This isn't a bug.
>
> > So in your mind, look at username as userName. It's the "name" field of the "user" table.
>
> > To override this behavior, you can always use the select argument to select the column names that you want.
>
This may be a flaw in Wheels or a bug that we need to submit. With
your firstName and lastName setup you can get around a little more by
adding the following line of code into your init() function of your
User model
<cfset property(name="fullName", sql="CONCAT(firstName, ' ',
lastName)")>
That line will enable you the fullName property in your finder methods
(findAll,findOne,etc)
I'll do that ... thanks!