mountetna / magma

Data server with friendly data loaders
GNU General Public License v2.0
5 stars 2 forks source link

Support update_attribute action #165

Open graft opened 4 years ago

graft commented 4 years ago

We wish to support the action 'update_attribute' in the /update_model controller. This action allows us to change properties of an existing attribute, excepting its name and type.

Following #164 we can instantiate this as Magma::UpdateAttributeAction < Magma::Action. The expected params would be at least model_name, attribute_name. The remaining params might come from Magma::Attribute::EDITABLE_OPTIONS.

The validation should presumably determine that the values for each EDITABLE_OPTION are well-formed - I'm not sure what sort of existing facility we have for this kind of validation, so it might need to be created.

If the inputs are well-formed, the method #action! might use Magma::Attribute.update_option to set the new value(s).