Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add class methods to restrict which columns are modified in new/set/u…
…pdate, as well as #(set|update)_(all|only|except) to go around them Model.set_allowed_columns makes it so that only the listed columns are modified (similar to ActiveRecord's attr_accessible). Model.set_restricted_columns makes it so that the listed columns are not modified (similar to ActiveRecord's attr_protected). Model.unrestrict_primary_key allows you to modify the primary key in new/set/update. Model.restrict_primary_key makes the primary key field a restricted column, and is the default (similar to ActiveRecord). Being the default, it is only useful in subclasses that have used unrestrict_primary_key. Model.restrict_primary_key? returns true/false depending on whether the primary key is restricted. Model#(set|update)_(all|only|except ignore the value of allowed_columns and restricted_columns. (set|update)_all update all columns. (set|update)_only take additional argument(s) specifying which columns to allow. (set|update)_except take additional argument(s) specifying which columns to restrict. In all cases, the restrict_primary_key setting remains in effect. Other setter methods previously callable via new/set/update are no longer allowed (RESTRICTED_SETTER_METHODS).
- Loading branch information
1 parent
d31a992
commit 7f36a64
Showing
7 changed files
with
385 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.