mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-04 21:15:19 +02:00
Add Property Details View (#1116)
* Add backend for property account details
* Rubocop updates
* Add property form with details
* Revert "Rubocop updates"
This reverts commit 05b0b8f3a4
.
* Bump brakeman to latest version
* Add overview section to property view
* Lint fixes
This commit is contained in:
parent
4433488562
commit
e856691c86
30 changed files with 547 additions and 81 deletions
20
app/models/measurement.rb
Normal file
20
app/models/measurement.rb
Normal file
|
@ -0,0 +1,20 @@
|
|||
class Measurement
|
||||
include ActiveModel::Validations
|
||||
|
||||
attr_reader :value, :unit
|
||||
|
||||
VALID_UNITS = %w[sqft sqm]
|
||||
|
||||
validates :unit, inclusion: { in: VALID_UNITS }
|
||||
validates :value, presence: true
|
||||
|
||||
def initialize(value, unit)
|
||||
@value = value.to_f
|
||||
@unit = unit.to_s.downcase.strip
|
||||
validate!
|
||||
end
|
||||
|
||||
def to_s
|
||||
"#{@value.to_i} #{@unit}"
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue