Reputation: 14784
For some reason, when I specify "random" in my order clause of findAll(), CFWHeels throws an error:
Wheels.ColumnNotFound
Wheels looked for the column mapped to the random property but couldn't find it in the database table. Suggested action
Verify the order argument and/or your property to column mappings done with the property method inside the model's init method to make sure everything is correct.
I have used calculated properties before, but this shouldn't be looking for any of that with regard to "random" ordering.
<cffunction name="random">
<cfparam name="params.page" default="1" />
<cfparam name="params.pageQuantity" default="5" />
<cfset posts = model("post").findAll(
select = "
posts.postID,
postTitle,
postPoints,
postAuthority,
postCreated,
postCommentCount,
postUpVoteCount,
postDownVoteCount,
users.userID,
userName,
categories.categoryID,
categoryTitle,
categoryToken",
include = "user,category",
order = "random",
page = params.page,
perPage = params.pageQuantity
) />
</cffunction>
Does this possibly have something to do with using a select
statement?
Would appreciate any help.
Many thanks, Michael.
Upvotes: 0
Views: 135
Reputation: 20804
As established in the commments.
If order by rand()
works in mySQL, the first thing I would try is order = 'rand()'
in the wheels function.
Upvotes: 3