Skip to content

ignoreColumns model config method - #1326

Merged
bpamiri merged 3 commits into
wheels-dev:developfrom
chapmandu:ignorecolumns-model-config
Nov 11, 2023
Merged

ignoreColumns model config method#1326
bpamiri merged 3 commits into
wheels-dev:developfrom
chapmandu:ignorecolumns-model-config

Conversation

@chapmandu

Copy link
Copy Markdown
Contributor

An option to ignore columns in all select queries so the specified columns are not selected. Useful when used with an existing database with many irrelevant columns.

The $initModelClass uses ignoredColumns to filter columns from the results of dbinfo

I've elected to use an array for the columns argument type as lists have proven to be slow to parse/manipulate.

models/Shop.cfc

component extends="Model" {

	function config() {
		ignoredColumns(columns = ["isblackmarket"]);
	}

}

Inspired by my own requirement and https://api.rubyonrails.org/classes/ActiveRecord/ModelSchema/ClassMethods.html#method-i-ignored_columns

@zainforbjs zainforbjs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chapmandu Thanks for creating PR, can You please look for some tests are failing. Thank you

@chapmandu
chapmandu changed the base branch from develop to main November 10, 2023 08:02
@chapmandu
chapmandu changed the base branch from main to develop November 10, 2023 08:03
@bpamiri
bpamiri requested a review from zainforbjs November 10, 2023 19:57
@bpamiri
bpamiri dismissed zainforbjs’s stale review November 11, 2023 01:22

Tests are passing now.

@bpamiri
bpamiri merged commit c6e8d9d into wheels-dev:develop Nov 11, 2023
@bpamiri

bpamiri commented Nov 11, 2023

Copy link
Copy Markdown
Collaborator

@MvdO79 Another opportunity for additions to the guides.

@MvdO79

MvdO79 commented Nov 17, 2023

Copy link
Copy Markdown
Contributor

@bpamiri Good idea, will do!

@chapmandu

Copy link
Copy Markdown
Contributor Author

@MvdO79 Great job with the docs 💪

@MvdO79

MvdO79 commented Nov 18, 2023

Copy link
Copy Markdown
Contributor

@chapmandu Glad to help 😄 And thank you for adding this functionality 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants