aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTeddy Wing2017-09-19 16:59:45 +0200
committerTeddy Wing2017-09-19 17:00:30 +0200
commite1547b52a372942b34cda3b3fee4ab76e9f1b65e (patch)
tree166d3bb167ad1b213a2fae98ec5daf22f3ea90ae /lib
parent30fc0d3f1a9a158a0d45bbaf2f78e176f74ac943 (diff)
downloadchouette-core-e1547b52a372942b34cda3b3fee4ab76e9f1b65e.tar.bz2
ModelAttribute: Add `#code` method
A method that returns a string representation of the attribute, in the form `:class#:name". This will be used to store a reference to the attribute in the database. For example, a validation will reference a `ModelAttribute` in a database column using this `#code` string. Refs #4401
Diffstat (limited to 'lib')
-rw-r--r--lib/model_attribute.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/model_attribute.rb b/lib/model_attribute.rb
index 081d0cd0f..22c366b37 100644
--- a/lib/model_attribute.rb
+++ b/lib/model_attribute.rb
@@ -55,4 +55,8 @@ class ModelAttribute
# Chouette::RoutingConstraintZone
define :routing_constraint_zone, :name, :string
+
+ def code
+ "#{@klass}##{@name}"
+ end
end