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.
584 lines
29 KiB
584 lines
29 KiB
9 months ago
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta charset="utf-8">
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
<title>
|
||
|
Module: Validations::TenancyValidations
|
||
|
|
||
|
— 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::TenancyValidations";
|
||
|
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 (T)</a> »
|
||
|
<span class='title'>Validations</span>
|
||
|
»
|
||
|
<span class="title">TenancyValidations</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::TenancyValidations
|
||
|
|
||
|
|
||
|
|
||
|
</h1>
|
||
|
<div class="box_info">
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<dl>
|
||
|
<dt>Includes:</dt>
|
||
|
<dd>SharedValidations</dd>
|
||
|
</dl>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<dl>
|
||
|
<dt>Defined in:</dt>
|
||
|
<dd>tenancy_validations.rb</dd>
|
||
|
</dl>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<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_general_needs_fixed_tenancy_length_affordable_social_rent-instance_method" title="#validate_general_needs_fixed_tenancy_length_affordable_social_rent (instance method)">#<strong>validate_general_needs_fixed_tenancy_length_affordable_social_rent</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_general_needs_fixed_tenancy_length_intermediate_rent-instance_method" title="#validate_general_needs_fixed_tenancy_length_intermediate_rent (instance method)">#<strong>validate_general_needs_fixed_tenancy_length_intermediate_rent</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_joint_tenancy-instance_method" title="#validate_joint_tenancy (instance method)">#<strong>validate_joint_tenancy</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_other_tenancy_type-instance_method" title="#validate_other_tenancy_type (instance method)">#<strong>validate_other_tenancy_type</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_periodic_tenancy_length-instance_method" title="#validate_periodic_tenancy_length (instance method)">#<strong>validate_periodic_tenancy_length</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_supported_housing_fixed_tenancy_length-instance_method" title="#validate_supported_housing_fixed_tenancy_length (instance method)">#<strong>validate_supported_housing_fixed_tenancy_length</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_tenancy_length_blank_when_not_required-instance_method" title="#validate_tenancy_length_blank_when_not_required (instance method)">#<strong>validate_tenancy_length_blank_when_not_required</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_general_needs_fixed_tenancy_length_affordable_social_rent-instance_method">
|
||
|
|
||
|
#<strong>validate_general_needs_fixed_tenancy_length_affordable_social_rent</strong>(record) ⇒ <tt>Object</tt>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</h3><table class="source_code">
|
||
|
<tr>
|
||
|
<td>
|
||
|
<pre class="lines">
|
||
|
|
||
|
|
||
|
19
|
||
|
20
|
||
|
21
|
||
|
22
|
||
|
23
|
||
|
24
|
||
|
25
|
||
|
26
|
||
|
27
|
||
|
28
|
||
|
29
|
||
|
30
|
||
|
31</pre>
|
||
|
</td>
|
||
|
<td>
|
||
|
<pre class="code"><span class="info file"># File 'tenancy_validations.rb', line 19</span>
|
||
|
|
||
|
<span class='kw'>def</span> <span class='id identifier rubyid_validate_general_needs_fixed_tenancy_length_affordable_social_rent'>validate_general_needs_fixed_tenancy_length_affordable_social_rent</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_tenancy_type_fixed_term?'>tenancy_type_fixed_term?</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_affordable_or_social_rent?'>affordable_or_social_rent?</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_is_general_needs?'>is_general_needs?</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_tenancylength'>tenancylength</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
|
||
|
|
||
|
<span class='id identifier rubyid_min_tenancy_length'>min_tenancy_length</span> <span class='op'>=</span> <span class='int'>2</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_tenancylength'>tenancylength</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='id identifier rubyid_min_tenancy_length'>min_tenancy_length</span><span class='comma'>,</span> <span class='int'>99</span><span class='rparen'>)</span>
|
||
|
|
||
|
<span class='id identifier rubyid_message'>message</span> <span class='op'>=</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.tenancy.length.invalid_fixed</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>min_tenancy_length:</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'>:needstype</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</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'>:rent_type</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</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'>:tenancylength</span><span class='comma'>,</span> <span class='symbol'>:tenancylength_invalid</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='id identifier rubyid_message'>message</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'>:tenancy</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</span>
|
||
|
<span class='kw'>end</span></pre>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div>
|
||
|
|
||
|
<div class="method_details ">
|
||
|
<h3 class="signature " id="validate_general_needs_fixed_tenancy_length_intermediate_rent-instance_method">
|
||
|
|
||
|
#<strong>validate_general_needs_fixed_tenancy_length_intermediate_rent</strong>(record) ⇒ <tt>Object</tt>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</h3><table class="source_code">
|
||
|
<tr>
|
||
|
<td>
|
||
|
<pre class="lines">
|
||
|
|
||
|
|
||
|
33
|
||
|
34
|
||
|
35
|
||
|
36
|
||
|
37
|
||
|
38
|
||
|
39
|
||
|
40
|
||
|
41
|
||
|
42
|
||
|
43
|
||
|
44
|
||
|
45</pre>
|
||
|
</td>
|
||
|
<td>
|
||
|
<pre class="code"><span class="info file"># File 'tenancy_validations.rb', line 33</span>
|
||
|
|
||
|
<span class='kw'>def</span> <span class='id identifier rubyid_validate_general_needs_fixed_tenancy_length_intermediate_rent'>validate_general_needs_fixed_tenancy_length_intermediate_rent</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_tenancy_type_fixed_term?'>tenancy_type_fixed_term?</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_affordable_or_social_rent?'>affordable_or_social_rent?</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_is_general_needs?'>is_general_needs?</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_tenancylength'>tenancylength</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
|
||
|
|
||
|
<span class='id identifier rubyid_min_tenancy_length'>min_tenancy_length</span> <span class='op'>=</span> <span class='int'>1</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_tenancylength'>tenancylength</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='id identifier rubyid_min_tenancy_length'>min_tenancy_length</span><span class='comma'>,</span> <span class='int'>99</span><span class='rparen'>)</span>
|
||
|
|
||
|
<span class='id identifier rubyid_message'>message</span> <span class='op'>=</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.tenancy.length.invalid_fixed</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>min_tenancy_length:</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'>:needstype</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</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'>:rent_type</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</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'>:tenancylength</span><span class='comma'>,</span> <span class='symbol'>:tenancylength_invalid</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='id identifier rubyid_message'>message</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'>:tenancy</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</span>
|
||
|
<span class='kw'>end</span></pre>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div>
|
||
|
|
||
|
<div class="method_details ">
|
||
|
<h3 class="signature " id="validate_joint_tenancy-instance_method">
|
||
|
|
||
|
#<strong>validate_joint_tenancy</strong>(record) ⇒ <tt>Object</tt>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</h3><table class="source_code">
|
||
|
<tr>
|
||
|
<td>
|
||
|
<pre class="lines">
|
||
|
|
||
|
|
||
|
71
|
||
|
72
|
||
|
73
|
||
|
74
|
||
|
75
|
||
|
76
|
||
|
77
|
||
|
78</pre>
|
||
|
</td>
|
||
|
<td>
|
||
|
<pre class="code"><span class="info file"># File 'tenancy_validations.rb', line 71</span>
|
||
|
|
||
|
<span class='kw'>def</span> <span class='id identifier rubyid_validate_joint_tenancy'>validate_joint_tenancy</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_collection_start_year'>collection_start_year</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_joint'>joint</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_joint'>joint</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_collection_start_year'>collection_start_year</span> <span class='op'>>=</span> <span class='int'>2022</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'>:joint</span><span class='comma'>,</span> <span class='symbol'>:not_joint_tenancy</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.tenancy.not_joint</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'>:hhmemb</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.tenancy.joint_more_than_one_member</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_other_tenancy_type-instance_method">
|
||
|
|
||
|
#<strong>validate_other_tenancy_type</strong>(record) ⇒ <tt>Object</tt>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</h3><table class="source_code">
|
||
|
<tr>
|
||
|
<td>
|
||
|
<pre class="lines">
|
||
|
|
||
|
|
||
|
67
|
||
|
68
|
||
|
69</pre>
|
||
|
</td>
|
||
|
<td>
|
||
|
<pre class="code"><span class="info file"># File 'tenancy_validations.rb', line 67</span>
|
||
|
|
||
|
<span class='kw'>def</span> <span class='id identifier rubyid_validate_other_tenancy_type'>validate_other_tenancy_type</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
|
||
|
<span class='id identifier rubyid_validate_other_field'>validate_other_field</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='comma'>,</span> <span class='int'>3</span><span class='comma'>,</span> <span class='symbol'>:tenancy</span><span class='comma'>,</span> <span class='symbol'>:tenancyother</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>tenancy type</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>other tenancy type</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
||
|
<span class='kw'>end</span></pre>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div>
|
||
|
|
||
|
<div class="method_details ">
|
||
|
<h3 class="signature " id="validate_periodic_tenancy_length-instance_method">
|
||
|
|
||
|
#<strong>validate_periodic_tenancy_length</strong>(record) ⇒ <tt>Object</tt>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</h3><table class="source_code">
|
||
|
<tr>
|
||
|
<td>
|
||
|
<pre class="lines">
|
||
|
|
||
|
|
||
|
47
|
||
|
48
|
||
|
49
|
||
|
50
|
||
|
51
|
||
|
52
|
||
|
53
|
||
|
54
|
||
|
55
|
||
|
56</pre>
|
||
|
</td>
|
||
|
<td>
|
||
|
<pre class="code"><span class="info file"># File 'tenancy_validations.rb', line 47</span>
|
||
|
|
||
|
<span class='kw'>def</span> <span class='id identifier rubyid_validate_periodic_tenancy_length'>validate_periodic_tenancy_length</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_is_periodic_tenancy?'>is_periodic_tenancy?</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_tenancylength'>tenancylength</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
|
||
|
|
||
|
<span class='id identifier rubyid_min_tenancy_length'>min_tenancy_length</span> <span class='op'>=</span> <span class='int'>1</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_tenancylength'>tenancylength</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='id identifier rubyid_min_tenancy_length'>min_tenancy_length</span><span class='comma'>,</span> <span class='int'>99</span><span class='rparen'>)</span>
|
||
|
|
||
|
<span class='id identifier rubyid_message'>message</span> <span class='op'>=</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.tenancy.length.invalid_periodic</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>min_tenancy_length:</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'>:tenancylength</span><span class='comma'>,</span> <span class='symbol'>:tenancylength_invalid</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='id identifier rubyid_message'>message</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'>:tenancy</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</span>
|
||
|
<span class='kw'>end</span></pre>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div>
|
||
|
|
||
|
<div class="method_details ">
|
||
|
<h3 class="signature " id="validate_supported_housing_fixed_tenancy_length-instance_method">
|
||
|
|
||
|
#<strong>validate_supported_housing_fixed_tenancy_length</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</pre>
|
||
|
</td>
|
||
|
<td>
|
||
|
<pre class="code"><span class="info file"># File 'tenancy_validations.rb', line 6</span>
|
||
|
|
||
|
<span class='kw'>def</span> <span class='id identifier rubyid_validate_supported_housing_fixed_tenancy_length'>validate_supported_housing_fixed_tenancy_length</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_tenancy_type_fixed_term?'>tenancy_type_fixed_term?</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_is_supported_housing?'>is_supported_housing?</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_tenancylength'>tenancylength</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
|
||
|
|
||
|
<span class='id identifier rubyid_min_tenancy_length'>min_tenancy_length</span> <span class='op'>=</span> <span class='int'>1</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_tenancylength'>tenancylength</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='id identifier rubyid_min_tenancy_length'>min_tenancy_length</span><span class='comma'>,</span> <span class='int'>99</span><span class='rparen'>)</span>
|
||
|
|
||
|
<span class='id identifier rubyid_message'>message</span> <span class='op'>=</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.tenancy.length.invalid_fixed</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>min_tenancy_length:</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'>:needstype</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</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'>:tenancylength</span><span class='comma'>,</span> <span class='symbol'>:tenancylength_invalid</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='id identifier rubyid_message'>message</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'>:tenancy</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</span>
|
||
|
<span class='kw'>end</span></pre>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div>
|
||
|
|
||
|
<div class="method_details ">
|
||
|
<h3 class="signature " id="validate_tenancy_length_blank_when_not_required-instance_method">
|
||
|
|
||
|
#<strong>validate_tenancy_length_blank_when_not_required</strong>(record) ⇒ <tt>Object</tt>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</h3><table class="source_code">
|
||
|
<tr>
|
||
|
<td>
|
||
|
<pre class="lines">
|
||
|
|
||
|
|
||
|
58
|
||
|
59
|
||
|
60
|
||
|
61
|
||
|
62
|
||
|
63
|
||
|
64
|
||
|
65</pre>
|
||
|
</td>
|
||
|
<td>
|
||
|
<pre class="code"><span class="info file"># File 'tenancy_validations.rb', line 58</span>
|
||
|
|
||
|
<span class='kw'>def</span> <span class='id identifier rubyid_validate_tenancy_length_blank_when_not_required'>validate_tenancy_length_blank_when_not_required</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'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_tenancylength'>tenancylength</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</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_tenancy_type_fixed_term?'>tenancy_type_fixed_term?</span> <span class='op'>||</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_is_periodic_tenancy?'>is_periodic_tenancy?</span>
|
||
|
|
||
|
<span class='id identifier rubyid_message'>message</span> <span class='op'>=</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.tenancy.length.fixed_term_not_required</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'>:tenancylength</span><span class='comma'>,</span> <span class='symbol'>:tenancylength_invalid</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='id identifier rubyid_message'>message</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'>:tenancy</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</span>
|
||
|
<span class='kw'>end</span></pre>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div id="footer">
|
||
|
Generated on Thu Apr 18 11:36:48 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>
|