From e1547b52a372942b34cda3b3fee4ab76e9f1b65e Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Tue, 19 Sep 2017 16:59:45 +0200 Subject: 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 --- lib/model_attribute.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib') 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 -- cgit v1.2.3