profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/chapmandu/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Adam Chapman chapmandu Melbourne, Australia chapmandu.com

cfwheels/cfwheels-example-app 16

A CFWheels 2.x App with user management, role based permissions and password resets

raulriera/Scaffold 12

Scaffold plugin for ColdFusion on Wheels

chapmandu/docker-railo 6

A Docker container for Railo & Nginx on Ubuntu

chrisdpeters/lucee-docker 5

A Docker container for the Lucee scripting language on Ubuntu with Nginx web server.

chapmandu/junify-cfwheels-plugin 3

Have the CFWheels test framework return jUnit XML

chapmandu/confirmerdisabler 1

CFWheels Legacy Javascript Confirmer & Disabler

chapmandu/simpleproperties-cfwheels-plugin 1

Return the simple properties of an object and any nested properties

chapmandu/UpgradeAdvisor 1

CFWheels 2.x Upgrade Advisor

chapmandu/cfdocs 0

Repository for the cfdocs.org site.

push eventcfwheels/cfwheels

Brian Ramsey

commit sha a41d8ded354b3d84de979f3f85fec0710ca40702

Fixes #1083 resources allow only empty (#1087)

view details

push time in 2 months

issue closedcfwheels/cfwheels

resources() should allow an empty "only" value

resources(name = "Foo", nested = true, only = "")
  .resources(name = "Bar")
.end()

This does not work as (I'd) expected where I'd like the relationship/nesting but I do not need/cannot use restful routes for the parent, but want to keep the structure (in this case, a legacy app with legacy pre-restful routes).

While not shown explicitly in the docs in rails https://guides.rubyonrails.org/routing.html#restricting-the-routes-created you can use an empty array only: [] to not have any routes at all, this shows up in testing and also mentioned in this SO answer: https://stackoverflow.com/a/27425638

Can we allow only to be passed as an empty list/string and be accepted?

closed time in 2 months

absentbri

PR merged cfwheels/cfwheels

Issue 1083 resources allow only empty

should just about do it for #1083 ...

+26 -1

0 comment

3 changed files

absentbri

pr closed time in 2 months

PullRequestReviewEvent

issue closedcfwheels/cfwheels

Migrator log overflows parent modal

Migration modal dialog overflow, minor/bugbear.

issue (excuse ugly/redactions) overflow-issue

Can fix with semantic-ui scroll content class, will raise PR: overflow-fix

closed time in 2 months

absentbri

issue commentcfwheels/cfwheels

Migrator log overflows parent modal

closed via 06cf285

absentbri

comment created time in 2 months

push eventcfwheels/cfwheels

Brian Ramsey

commit sha 06cf285b83b9aee1d695cbb4665c2f14dd6caa53

migrator ui overflow tweak #1085 (#1086)

view details

push time in 2 months

PR merged cfwheels/cfwheels

addresses #1085

Addresses #1085

Never added to changelog before so probably messed it up...

+4 -3

0 comment

2 changed files

absentbri

pr closed time in 2 months

PullRequestReviewEvent

issue closedcfwheels/cfwheels

Association validation/update/save inconsistency

Hi CFWheels Team,

I recently started a job working on a team of Lucee/CFWheels developers and I've been enjoying the experience so far.

I was investigating a bug we had recently where a model's update function was failing (returning false) yet the valid function was returning true, I looked into it, mainly the wheels/model/[nestedproperties.cfm, create.cfm, validations.cfm, and update.cfm] files, and found there to be a bit of inconsistency with the way association validation is handled.

When running model.valid() it seems to only run $validateAssociations as an aside and does not really take into account the associations validity when returning the parent model's validity.

In fact $validateAssociations will always returns true.

But when updating or saving a model, the association validation is taken a little more seriously, and the return of the $saveAssociations function in create.cfm:221 is actually considered and the parent model won't save if any associations fail to save.

Now there doesn't seem to be a good way of access the generated errors of an association that I can see when validating/updating/saving the parent model, and our parent model has a grand total of 47 associations.

So I just wanted to raise a discussion around whether the current pattern is ideal or not, and if there are any established techniques for logging the errors of associations?

I know I can do for (association in model.$classData().associations) { model[association].allErrors() }

but I'm just wondering if the valid function should take the validation of associations into account in its return? And maybe if something like for (association in model.$classData().associations) { model[association].allErrors() } should be built in?

Kindly, Nikolaj Frey

closed time in 2 months

nikolajfrey

issue commentcfwheels/cfwheels

Association validation/update/save inconsistency

Added

nikolajfrey

comment created time in 2 months

push eventcfwheels/cfwheels

Adam Chapman

commit sha 43738816d390d4e90e405a786c42e5ab1e7b0acc

Update CHANGELOG.md

view details

push time in 2 months

PR closed cfwheels/cfwheels

Reviewers
adds paginationCountMode findAll argument

MySQL count() performs horrendously on large recordsets.

Allow a pagination configuration setting argument to substitute the initial pagination count() for a findAll() that selects the primary key column then uses recordCount. This DOES introduce the overhead of sending the primary key column data across the network, but this may be an acceptable compromise.

+31 -3

6 comments

2 changed files

chapmandu

pr closed time in 2 months

pull request commentcfwheels/cfwheels

adds paginationCountMode findAll argument

Closing. Issue can be resolved with database optimisation.

chapmandu

comment created time in 2 months

push eventcfwheels/cfwheels

Nikolaj Frey

commit sha 7b61bbb983a72cf091c5f26c28e34e5cfa228d34

Adds association error support to cfwheels (#1081)

view details

push time in 2 months

PR merged cfwheels/cfwheels

Reviewers
Adds association error support to cfwheels

I have tried to add this functionality with no affect to backwards compatibility. Open to improvements and the like.

I hope you like the implementation.

+181 -10

2 comments

9 changed files

nikolajfrey

pr closed time in 2 months

PullRequestReviewEvent

push eventnikolajfrey/cfwheels

Adam Chapman

commit sha 3ce02311ef9399d518fe7fef2000ab245c35d6fb

whoops

view details

push time in 2 months

PullRequestReviewEvent

Pull request review commentcfwheels/cfwheels

Adds association error support to cfwheels

 public void function addErrorToBase(required string message, string name = "") {  *  * [section: Model Object]  * [category: Error Functions]+ *+ * @seenErrors is a private argument not meant to be used by the user, the function uses this to ensure circular dependancy avoidance.+ * It does this by storing instances of models that are associations, and not checking associations of those instances because they have already been checked.  */-public array function allErrors() {+public array function allErrors(boolean includeAssociations = false, array seenErrors = []) {+	if (arguments.includeAssociations) {+		local.rv = [];+		ArrayAppend(local.rv, variables.wheels.errors, true);+		ArrayAppend(local.rv, allAssociationErrors(arguments.seenErrors), true);+		return local.rv;+	} 	return variables.wheels.errors; } +/**+ * Gets all associated errors recursively+ *+ * [section: Model Object]+ * [category: Error Functions]+ */+private array function allAssociationErrors(array seenErrors = []) {+	local.rv = [];+	for (local.association in variables.wheels.class.associations; {
	for (local.association in variables.wheels.class.associations) {
nikolajfrey

comment created time in 2 months

push eventnikolajfrey/cfwheels

Adam Chapman

commit sha f87d7cc8830e23fcd891a9f4cd361746390dc155

remove redundant teardown

view details

push time in 2 months

Pull request review commentcfwheels/cfwheels

Adds association error support to cfwheels

+component extends="wheels.tests.Test" {++	function setup() {+		user = model("user").new({+			username: "Mike",+			password: "password",+			firstname: "Michael",+			lastname: "Jackson"+		});+		user.$classData().associations.author.nested.allow = true;+		user.$classData().associations.author.nested.autoSave = true;++	}++	function teardown() {+		user.$classData().associations.author.nested.allow = false;+		user.$classData().associations.author.nested.autoSave = false;+	}+++	function test_model_valid_returns_whether_associations_are_not_valid() {++		user.author = model("author").new();++		user.author.firstname = "";+		userValid = user.valid(validateAssociations = true);+		assert('!userValid');+	}++	function test_model_valid_returns_whether_nested_associations_are_not_valid() {+		user.author = model("author").new();++		user.author.profile = model("profile").new();+		user.author.$classData().associations.profile.nested.allow = true;+		user.author.$classData().associations.profile.nested.autoSave = true;++		user.author.profile.dateOfBirth = "";++		userValid = user.valid(validateAssociations = true);+		user.author.$classData().associations.profile.nested.allow = false;+		user.author.$classData().associations.profile.nested.autoSave = false;+		assert('!userValid');++	}++	function test_model_valid_returns_whether_associations_are_not_valid_with_errors_on_parent_and_associations() {+		user.author = model("author").new();+		user.author.firstname = "";++		user.author.profile = model("profile").new();+		user.author.$classData().associations.profile.nested.allow = true;+		user.author.$classData().associations.profile.nested.autoSave = true;++		user.author.profile.dateOfBirth = "";++		userValid = user.valid(validateAssociations = true);++		user.author.$classData().associations.profile.nested.allow = false;+		user.author.$classData().associations.profile.nested.autoSave = false;

nikolajfrey

comment created time in 2 months

PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commentcfwheels/cfwheels

Adds association error support to cfwheels

+component extends="wheels.tests.Test" {++	function setup() {+		user = model("user").new({+			username: "Mike",+			password: "password",+			firstname: "Michael",+			lastname: "Jackson"+		});+		user.$classData().associations.author.nested.allow = true;+		user.$classData().associations.author.nested.autoSave = true;++	}++	function teardown() {+		user.$classData().associations.author.nested.allow = false;+		user.$classData().associations.author.nested.autoSave = false;+	}+++	function test_model_valid_returns_whether_associations_are_not_valid() {++		user.author = model("author").new();++		user.author.firstname = "";+		userValid = user.valid(validateAssociations = true);+		assert('!userValid');+	}++	function test_model_valid_returns_whether_nested_associations_are_not_valid() {+		user.author = model("author").new();++		user.author.profile = model("profile").new();+		user.author.$classData().associations.profile.nested.allow = true;+		user.author.$classData().associations.profile.nested.autoSave = true;++		user.author.profile.dateOfBirth = "";++		userValid = user.valid(validateAssociations = true);+		user.author.$classData().associations.profile.nested.allow = false;+		user.author.$classData().associations.profile.nested.autoSave = false;+		assert('!userValid');
		userValid = user.valid(validateAssociations = true);
		assert('!userValid');
nikolajfrey

comment created time in 2 months

PullRequestReviewEvent

Pull request review commentcfwheels/cfwheels

Adds association error support to cfwheels

+component extends="wheels.tests.Test" {++	function setup() {+		user = model("user").new({+			username: "Mike",+			password: "password",+			firstname: "Michael",+			lastname: "Jackson"+		});+		user.$classData().associations.author.nested.allow = true;+		user.$classData().associations.author.nested.autoSave = true;++	}++	function teardown() {+		user.$classData().associations.author.nested.allow = false;+		user.$classData().associations.author.nested.autoSave = false;+	}
nikolajfrey

comment created time in 2 months

PullRequestReviewEvent

Pull request review commentcfwheels/cfwheels

Adds association error support to cfwheels

+component extends="wheels.tests.Test" {++	function setup() {+	}++	function test_get_associated_errors_returns_array_including_associated_model_errors() {+		user = model("user").findOne();+		user.addError("firstname", "firstname error1");+		user.author = model("author").findOne(include = "profile");+		user.author.addError("lastname", "lastname error1");+		errors = user.allErrors(includeAssociations = true);+		actual = ArrayLen(errors);+		expected = 2;+		assert("actual eq expected");+	}++	function test_get_associated_errors_returns_array_including_associated_model_errors_deeply() {+		user = model("user").findOne();+		user.addError("firstname", "firstname error1");+		user.author = model("author").findOne(include = "profile");+		user.author.addError("lastname", "lastname error1");+		user.author.profile.addError("profiletype", "profiletype error1");+		errors = user.allErrors(includeAssociations = true);+		actual = ArrayLen(errors);+		expected = 3;+		assert("actual eq expected");+	}++	function test_get_associated_errors_returns_array_including_associated_model_errors_and_handles_circular_reference() {+		user = model("user").findOne();+		user.addError("firstname", "firstname error1");+		user.author = model("author").findOne(include = "profile");+		user.author.addError("lastname", "lastname error1");+		user.author.profile.addError("profiletype", "profiletype error1");+		user.author.profile.$classData().associations.author.nested.allow = true;+		user.author.profile.$classData().associations.author.nested.autoSave = true;+		user.author.profile.author = user.author;+		errors = user.allErrors(includeAssociations = true);+		actual = ArrayLen(errors);+		expected = 3;+		user.author.profile.$classData().associations.author.nested.allow = false;+		user.author.profile.$classData().associations.author.nested.autoSave = false;
nikolajfrey

comment created time in 2 months

push eventnikolajfrey/cfwheels

Adam Chapman

commit sha 110ed92d69c7ad15167adde9b56f70dde7aaa661

Apply suggestions from code review

view details

push time in 2 months