Module: UnitMeasurements::Rails::Helpers
- Defined in:
- lib/unit_measurements/rails/helpers.rb
Overview
The UnitMeasurements::Rails::Helpers
module provides helper methods for handling ActiveRecord
models in the context of unit measurements.
Instance Method Summary collapse
-
#column_exists?(column_name) ⇒ void
Checks the existence of a
column_name
within the database table associated with theActiveRecord
model.
Instance Method Details
#column_exists?(column_name) ⇒ void
This method returns an undefined value.
Checks the existence of a column_name
within the database table associated with the ActiveRecord
model.
28 29 30 31 32 |
# File 'lib/unit_measurements/rails/helpers.rb', line 28 def column_exists?(column_name) unless self.class.column_names.include?(column_name) raise ArgumentError, "Column '#{column_name}' does not exist in the database for table '#{self.class.table_name}'." end end |