You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
435 lines
24 KiB
435 lines
24 KiB
<!DOCTYPE html> |
|
<html> |
|
<head> |
|
<meta charset="utf-8"> |
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|
<title> |
|
Module: Validations::PropertyValidations |
|
|
|
— Documentation by YARD 0.9.36 |
|
|
|
</title> |
|
|
|
<link rel="stylesheet" href="../css/style.css" type="text/css" /> |
|
|
|
<link rel="stylesheet" href="../css/common.css" type="text/css" /> |
|
|
|
<script type="text/javascript"> |
|
pathId = "Validations::PropertyValidations"; |
|
relpath = '../'; |
|
</script> |
|
|
|
|
|
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script> |
|
|
|
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script> |
|
|
|
|
|
</head> |
|
<body> |
|
<div class="nav_wrap"> |
|
<iframe id="nav" src="../class_list.html?1"></iframe> |
|
<div id="resizer"></div> |
|
</div> |
|
|
|
<div id="main" tabindex="-1"> |
|
<div id="header"> |
|
<div id="menu"> |
|
|
|
<a href="../_index.html">Index (P)</a> » |
|
<span class='title'>Validations</span> |
|
» |
|
<span class="title">PropertyValidations</span> |
|
|
|
</div> |
|
|
|
<div id="search"> |
|
|
|
<a class="full_list_link" id="class_list_link" |
|
href="../class_list.html"> |
|
|
|
<svg width="24" height="24"> |
|
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect> |
|
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect> |
|
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect> |
|
</svg> |
|
</a> |
|
|
|
</div> |
|
<div class="clear"></div> |
|
</div> |
|
|
|
<div id="content"><h1>Module: Validations::PropertyValidations |
|
|
|
|
|
|
|
</h1> |
|
<div class="box_info"> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<dl> |
|
<dt>Defined in:</dt> |
|
<dd>property_validations.rb</dd> |
|
</dl> |
|
|
|
</div> |
|
|
|
|
|
|
|
<h2> |
|
Constant Summary |
|
<small><a href="#" class="constants_summary_toggle">collapse</a></small> |
|
</h2> |
|
|
|
<dl class="constants"> |
|
|
|
<dt id="REFERRAL_INVALID_TMP-constant" class="">REFERRAL_INVALID_TMP = |
|
<div class="docstring"> |
|
<div class="discussion"> |
|
|
|
<p>Validations methods need to be called ‘validate_<page_name>’ to run on model save or ‘validate_’ to run on submit as well</p> |
|
|
|
|
|
</div> |
|
</div> |
|
<div class="tags"> |
|
|
|
|
|
</div> |
|
</dt> |
|
<dd><pre class="code"><span class='lbracket'>[</span><span class='int'>8</span><span class='comma'>,</span> <span class='int'>10</span><span class='comma'>,</span> <span class='int'>12</span><span class='comma'>,</span> <span class='int'>13</span><span class='comma'>,</span> <span class='int'>14</span><span class='comma'>,</span> <span class='int'>15</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd> |
|
|
|
</dl> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h2> |
|
Instance Method Summary |
|
<small><a href="#" class="summary_toggle">collapse</a></small> |
|
</h2> |
|
|
|
<ul class="summary"> |
|
|
|
<li class="public "> |
|
<span class="summary_signature"> |
|
|
|
<a href="#validate_rsnvac-instance_method" title="#validate_rsnvac (instance method)">#<strong>validate_rsnvac</strong>(record) ⇒ Object </a> |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'></div></span> |
|
|
|
</li> |
|
|
|
|
|
<li class="public "> |
|
<span class="summary_signature"> |
|
|
|
<a href="#validate_shared_housing_rooms-instance_method" title="#validate_shared_housing_rooms (instance method)">#<strong>validate_shared_housing_rooms</strong>(record) ⇒ Object </a> |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'></div></span> |
|
|
|
</li> |
|
|
|
|
|
<li class="public "> |
|
<span class="summary_signature"> |
|
|
|
<a href="#validate_unitletas-instance_method" title="#validate_unitletas (instance method)">#<strong>validate_unitletas</strong>(record) ⇒ Object </a> |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'></div></span> |
|
|
|
</li> |
|
|
|
|
|
<li class="public "> |
|
<span class="summary_signature"> |
|
|
|
<a href="#validate_uprn-instance_method" title="#validate_uprn (instance method)">#<strong>validate_uprn</strong>(record) ⇒ Object </a> |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'></div></span> |
|
|
|
</li> |
|
|
|
|
|
</ul> |
|
|
|
|
|
|
|
|
|
<div id="instance_method_details" class="method_details_list"> |
|
<h2>Instance Method Details</h2> |
|
|
|
|
|
<div class="method_details first"> |
|
<h3 class="signature first" id="validate_rsnvac-instance_method"> |
|
|
|
#<strong>validate_rsnvac</strong>(record) ⇒ <tt>Object</tt> |
|
|
|
|
|
|
|
|
|
|
|
</h3><table class="source_code"> |
|
<tr> |
|
<td> |
|
<pre class="lines"> |
|
|
|
|
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27</pre> |
|
</td> |
|
<td> |
|
<pre class="code"><span class="info file"># File 'property_validations.rb', line 6</span> |
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_validate_rsnvac'>validate_rsnvac</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span> |
|
<span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_first_time_property_let_as_social_housing?'>first_time_property_let_as_social_housing?</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_has_first_let_vacancy_reason?'>has_first_let_vacancy_reason?</span> |
|
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:rsnvac</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>validations.property.rsnvac.first_let_not_social</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> |
|
<span class='kw'>end</span> |
|
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_first_time_property_let_as_social_housing?'>first_time_property_let_as_social_housing?</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_rsnvac'>rsnvac</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&&</span> <span class='op'>!</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_has_first_let_vacancy_reason?'>has_first_let_vacancy_reason?</span> |
|
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:rsnvac</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>validations.property.rsnvac.first_let_social</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> |
|
<span class='kw'>end</span> |
|
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_is_relet_to_temp_tenant?'>is_relet_to_temp_tenant?</span> <span class='op'>&&</span> <span class='op'>!</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_previous_tenancy_was_temporary?'>previous_tenancy_was_temporary?</span> |
|
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:rsnvac</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>validations.property.rsnvac.non_temp_accommodation</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> |
|
<span class='kw'>end</span> |
|
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_is_relet_to_temp_tenant?'>is_relet_to_temp_tenant?</span> <span class='op'>&&</span> <span class='const'><span class='object_link'><a href="#REFERRAL_INVALID_TMP-constant" title="Validations::PropertyValidations::REFERRAL_INVALID_TMP (constant)">REFERRAL_INVALID_TMP</a></span></span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_referral'>referral</span><span class='rparen'>)</span> |
|
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:rsnvac</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>validations.property.rsnvac.referral_invalid</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> |
|
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:referral</span><span class='comma'>,</span> <span class='symbol'>:referral_invalid</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>validations.household.referral.rsnvac_non_temp</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> |
|
<span class='kw'>end</span> |
|
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_renewal'>renewal</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_renewal'>renewal</span><span class='period'>.</span><span class='id identifier rubyid_zero?'>zero?</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_rsnvac'>rsnvac</span> <span class='op'>==</span> <span class='int'>14</span> |
|
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:rsnvac</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>validations.property.rsnvac.not_a_renewal</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> |
|
<span class='kw'>end</span> |
|
<span class='kw'>end</span></pre> |
|
</td> |
|
</tr> |
|
</table> |
|
</div> |
|
|
|
<div class="method_details "> |
|
<h3 class="signature " id="validate_shared_housing_rooms-instance_method"> |
|
|
|
#<strong>validate_shared_housing_rooms</strong>(record) ⇒ <tt>Object</tt> |
|
|
|
|
|
|
|
|
|
|
|
</h3><table class="source_code"> |
|
<tr> |
|
<td> |
|
<pre class="lines"> |
|
|
|
|
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51</pre> |
|
</td> |
|
<td> |
|
<pre class="code"><span class="info file"># File 'property_validations.rb', line 35</span> |
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_validate_shared_housing_rooms'>validate_shared_housing_rooms</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span> |
|
<span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_unittype_gn'>unittype_gn</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> |
|
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_is_bedsit?'>is_bedsit?</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_beds'>beds</span> <span class='op'>!=</span> <span class='int'>1</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_beds'>beds</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&&</span> <span class='op'>!</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_form'>form</span><span class='period'>.</span><span class='id identifier rubyid_start_year_after_2024?'>start_year_after_2024?</span> |
|
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:unittype_gn</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>validations.property.unittype_gn.one_bedroom_bedsit</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> |
|
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:beds</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>validations.property.unittype_gn.one_bedroom_bedsit</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> |
|
<span class='kw'>end</span> |
|
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_hhmemb'>hhmemb</span> <span class='op'>==</span> <span class='int'>1</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_is_shared_housing?'>is_shared_housing?</span> <span class='op'>&&</span> |
|
<span class='op'>!</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_beds'>beds</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='period'>.</span><span class='id identifier rubyid_between?'>between?</span><span class='lparen'>(</span><span class='int'>1</span><span class='comma'>,</span> <span class='int'>3</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_beds'>beds</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> |
|
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:unittype_gn</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>validations.property.unittype_gn.one_three_bedroom_single_tenant_shared</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> |
|
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:beds</span><span class='comma'>,</span> <span class='symbol'>:one_three_bedroom_single_tenant_shared</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>validations.property.unittype_gn.one_three_bedroom_single_tenant_shared</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> |
|
<span class='kw'>elsif</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_is_shared_housing?'>is_shared_housing?</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_beds'>beds</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&&</span> <span class='op'>!</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_beds'>beds</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='period'>.</span><span class='id identifier rubyid_between?'>between?</span><span class='lparen'>(</span><span class='int'>1</span><span class='comma'>,</span> <span class='int'>7</span><span class='rparen'>)</span> |
|
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:unittype_gn</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>validations.property.unittype_gn.one_seven_bedroom_shared</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> |
|
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:beds</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>validations.property.unittype_gn.one_seven_bedroom_shared</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> |
|
<span class='kw'>end</span> |
|
<span class='kw'>end</span> |
|
<span class='kw'>end</span></pre> |
|
</td> |
|
</tr> |
|
</table> |
|
</div> |
|
|
|
<div class="method_details "> |
|
<h3 class="signature " id="validate_unitletas-instance_method"> |
|
|
|
#<strong>validate_unitletas</strong>(record) ⇒ <tt>Object</tt> |
|
|
|
|
|
|
|
|
|
|
|
</h3><table class="source_code"> |
|
<tr> |
|
<td> |
|
<pre class="lines"> |
|
|
|
|
|
29 |
|
30 |
|
31 |
|
32 |
|
33</pre> |
|
</td> |
|
<td> |
|
<pre class="code"><span class="info file"># File 'property_validations.rb', line 29</span> |
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_validate_unitletas'>validate_unitletas</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span> |
|
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_first_time_property_let_as_social_housing?'>first_time_property_let_as_social_housing?</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_unitletas'>unitletas</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> |
|
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:unitletas</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>validations.property.rsnvac.previous_let_social</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> |
|
<span class='kw'>end</span> |
|
<span class='kw'>end</span></pre> |
|
</td> |
|
</tr> |
|
</table> |
|
</div> |
|
|
|
<div class="method_details "> |
|
<h3 class="signature " id="validate_uprn-instance_method"> |
|
|
|
#<strong>validate_uprn</strong>(record) ⇒ <tt>Object</tt> |
|
|
|
|
|
|
|
|
|
|
|
</h3><table class="source_code"> |
|
<tr> |
|
<td> |
|
<pre class="lines"> |
|
|
|
|
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59</pre> |
|
</td> |
|
<td> |
|
<pre class="code"><span class="info file"># File 'property_validations.rb', line 53</span> |
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_validate_uprn'>validate_uprn</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span> |
|
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_uprn'>uprn</span> |
|
|
|
<span class='kw'>return</span> <span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_uprn'>uprn</span><span class='period'>.</span><span class='id identifier rubyid_match?'>match?</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^[0-9]{1,12}$</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span> |
|
|
|
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:uprn</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>validations.property.uprn.invalid</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> |
|
<span class='kw'>end</span></pre> |
|
</td> |
|
</tr> |
|
</table> |
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div id="footer"> |
|
Generated on Thu Apr 18 11:36:47 2024 by |
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> |
|
0.9.36 (ruby-3.1.4). |
|
</div> |
|
|
|
</div> |
|
</body> |
|
</html> |