This file contains hidden or 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
# frozen_string_literal: true | |
# Controller concern for basic crud. | |
# Can be added to any controller like so | |
# include Crud | |
# Assumptions: | |
# 1. Model class defines a constant called WHITELIST_FIELDS | |
# as an array of symbols for attributed that are allowed for creating a record. | |
# 2. Model is serialized elsewhwere. This can be done either by overwriting as_json | |
# method in the model class, or by using separate serializers. By default as_json |