1
0
This repository has been archived on 2023-12-07. You can view files and clone it, but cannot push or open issues or pull requests.
body_tracking/lib/body_tracking/togglable_columns.rb
cryptogopher 18419f1aeb Added MeasurementRoutine as a nested Measurement model
Updated ItemsWithQuantities to work with MeasurementRoutine
Replaced ColumnViews HABTM with polymorphic HMT
Added Measurement notes
Added destroy restrictions on Quantity
Replaced BodyTrackingPluginController with Finders concern
Removed 'body_trackers' prefix from paths
Unified styling for textarea
2020-03-29 00:56:37 +01:00

8 lines
230 B
Ruby

module BodyTracking::TogglableColumns
# TODO: enforce 'domain' identity between quantites and receiving collection?
def toggle!(q)
column = find_by(quantity: q)
column ? destroy(column) : create(quantity: q)
end
end