2511 lines
61 KiB
HTML
2511 lines
61 KiB
HTML
|
<html>
|
||
|
<head>
|
||
|
<style>
|
||
|
table { background: #fff; color: #000; }
|
||
|
.ruby .normal { color: #000; }
|
||
|
.ruby .comment { color: #005; font-style: italic; }
|
||
|
.ruby .keyword { color: #A44; font-weight: bold; }
|
||
|
.ruby .method { color: #44f; }
|
||
|
.ruby .class { color: #b1713d; }
|
||
|
.ruby .module { color: #050; }
|
||
|
.ruby .punct { color: #668; font-weight: bold; }
|
||
|
.ruby .symbol { color: #00f; }
|
||
|
.ruby .string { color: #4a4; }
|
||
|
.ruby .char { color: #F07; }
|
||
|
.ruby .ident { color: #000; }
|
||
|
.ruby .constant { color: #b1713d; }
|
||
|
.ruby .regex { color: #B66; background: #FEF; }
|
||
|
.ruby .number { color: #F99; }
|
||
|
.ruby .attribute { color: #f84; }
|
||
|
.ruby .global { color: #7FB; }
|
||
|
.ruby .expr { color: #227; }
|
||
|
.ruby .escape { color: #277; }
|
||
|
</style>
|
||
|
<title>Analyzed File Report</title>
|
||
|
</head>
|
||
|
<body>
|
||
|
<table cellpadding='0' cellspacing='0' class='ruby'>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n1" name="n1">1</a></span><span class="keyword">class</span> <span class="class">MissionsController</span> < <span class="constant">ApplicationController</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
<ul>
|
||
|
|
||
|
<li>remove trailing whitespace » rails_best_practices</li>
|
||
|
|
||
|
</ul>
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n2" name="n2">2</a></span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n3" name="n3">3</a></span> before_action <span class="symbol">:authenticate</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n4" name="n4">4</a></span> skip_before_action <span class="symbol">:verify_authenticity_token</span>, <span class="symbol">:only</span> => [
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n5" name="n5">5</a></span> <span class="symbol">:create</span>,
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n6" name="n6">6</a></span> <span class="symbol">:getlist</span>,
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n7" name="n7">7</a></span> <span class="symbol">:detail</span>,
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n8" name="n8">8</a></span> <span class="symbol">:update</span>,
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"> <a href="#n9" name="n9">9</a></span> <span class="symbol">:commentPublish</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><strong><a href="#n10" name="n10">10</a></strong></span> ]
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n11" name="n11">11</a></span> <span class="comment">#======================================></span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n12" name="n12">12</a></span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n13" name="n13">13</a></span> <span class="keyword">def</span> <span class="function">getlist</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n14" name="n14">14</a></span> <span class="comment">#Todo</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n15" name="n15">15</a></span> pid = params[<span class="symbol">:project_id</span>]
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n16" name="n16">16</a></span> stu = params[<span class="symbol">:status_type</span>]
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n17" name="n17">17</a></span> <span class="comment">#missions = []</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n18" name="n18">18</a></span> details = []
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n19" name="n19">19</a></span> missions = <span class="constant">Mission</span>.where(<span class="string"><span class="delimiter">"</span><span class="content">project_id = ? AND status = ?</span><span class="delimiter">"</span></span>,pid,stu).all
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><strong><a href="#n20" name="n20">20</a></strong></span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n21" name="n21">21</a></span> missions.each <span class="keyword">do</span> |mission|
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n22" name="n22">22</a></span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n23" name="n23">23</a></span> <span class="comment">#puts mission.inspect</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n24" name="n24">24</a></span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n25" name="n25">25</a></span> details += [{
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n26" name="n26">26</a></span> <span class="symbol">:id</span> => mission.id,
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n27" name="n27">27</a></span> <span class="symbol">:name</span> => mission.name,
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n28" name="n28">28</a></span> <span class="symbol">:content</span> => mission.content
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n29" name="n29">29</a></span> }]
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><strong><a href="#n30" name="n30">30</a></strong></span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n31" name="n31">31</a></span> <span class="keyword">end</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n32" name="n32">32</a></span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n33" name="n33">33</a></span> <span class="comment"># Mission.where(:project_id => pid).where(:status => stu) do |i|</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n34" name="n34">34</a></span> <span class="comment"># missions += [{</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n35" name="n35">35</a></span> <span class="comment"># :id => i.id,</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n36" name="n36">36</a></span> <span class="comment"># :name => i.name,</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n37" name="n37">37</a></span> <span class="comment"># :content => i.content</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n38" name="n38">38</a></span> <span class="comment"># }]</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n39" name="n39">39</a></span> <span class="comment"># end</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><strong><a href="#n40" name="n40">40</a></strong></span> render <span class="symbol">:json</span> => {
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n41" name="n41">41</a></span> <span class="symbol">:code</span> => <span class="integer">0</span>,
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n42" name="n42">42</a></span> <span class="symbol">:data</span> => missions
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n43" name="n43">43</a></span> }
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n44" name="n44">44</a></span> <span class="keyword">end</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n45" name="n45">45</a></span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n46" name="n46">46</a></span> <span class="comment">#======================================></span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n47" name="n47">47</a></span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
<ul>
|
||
|
|
||
|
<li>move model logic into model (mission use_count > 4) » rails_best_practices</li>
|
||
|
|
||
|
</ul>
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n48" name="n48">48</a></span> <span class="keyword">def</span> <span class="function">detail</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n49" name="n49">49</a></span> <span class="comment">#Todo</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><strong><a href="#n50" name="n50">50</a></strong></span> username = []
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n51" name="n51">51</a></span> comments_s = []
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n52" name="n52">52</a></span> mission_id = params[<span class="symbol">:id</span>]
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n53" name="n53">53</a></span> mission = <span class="constant">Mission</span>.find_by(<span class="key">id</span>: mission_id)
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n54" name="n54">54</a></span> m_us = <span class="constant">Missions_user</span>.where(<span class="string"><span class="delimiter">"</span><span class="content">mission_id = ?</span><span class="delimiter">"</span></span>,mission_id).all
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n55" name="n55">55</a></span> <span class="comment">#puts m_us.inspect</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n56" name="n56">56</a></span> m_us.each <span class="keyword">do</span> |m_u|
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n57" name="n57">57</a></span> user_id = m_u.user_id
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n58" name="n58">58</a></span> user = <span class="constant">User</span>.find_by(<span class="key">id</span>: user_id)
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n59" name="n59">59</a></span> <span class="comment">#puts user.inspect</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><strong><a href="#n60" name="n60">60</a></strong></span> username << user.name
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n61" name="n61">61</a></span> <span class="keyword">end</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n62" name="n62">62</a></span> comments = <span class="constant">Comment</span>.where(<span class="string"><span class="delimiter">"</span><span class="content">mission_id = ?</span><span class="delimiter">"</span></span>,mission_id).all
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n63" name="n63">63</a></span> comments.each <span class="keyword">do</span> |c|
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n64" name="n64">64</a></span> uname = <span class="constant">User</span>.find_by(<span class="key">id</span>: c.user_id).name
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n65" name="n65">65</a></span> comments_s += [{
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n66" name="n66">66</a></span> <span class="symbol">:nickname</span> => uname,
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n67" name="n67">67</a></span> <span class="symbol">:content</span> => c.content,
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n68" name="n68">68</a></span> <span class="symbol">:time</span> => c.created_at
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n69" name="n69">69</a></span> }]
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><strong><a href="#n70" name="n70">70</a></strong></span> <span class="keyword">end</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n71" name="n71">71</a></span> <span class="comment">#puts comments_s.inspect</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n72" name="n72">72</a></span> render <span class="symbol">:json</span> => {
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n73" name="n73">73</a></span> <span class="symbol">:code</span> => <span class="integer">0</span>,
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n74" name="n74">74</a></span> <span class="symbol">:data</span> => {
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n75" name="n75">75</a></span> <span class="symbol">:name</span> => mission.name,
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n76" name="n76">76</a></span> <span class="symbol">:content</span> => mission.content,
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n77" name="n77">77</a></span> <span class="symbol">:priority</span> => mission.priority,
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n78" name="n78">78</a></span> <span class="symbol">:status</span> => mission.status,
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n79" name="n79">79</a></span> <span class="symbol">:deadline</span> => mission.deadline,
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><strong><a href="#n80" name="n80">80</a></strong></span> <span class="symbol">:users</span> => username,
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n81" name="n81">81</a></span> <span class="symbol">:comments</span> => comments_s
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n82" name="n82">82</a></span> }
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n83" name="n83">83</a></span> }
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n84" name="n84">84</a></span> <span class="keyword">end</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n85" name="n85">85</a></span> <span class="comment">#======================================></span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n86" name="n86">86</a></span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
<ul>
|
||
|
|
||
|
<li>move model logic into model (mission use_count > 4) » rails_best_practices</li>
|
||
|
|
||
|
</ul>
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n87" name="n87">87</a></span> <span class="keyword">def</span> <span class="function">create</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n88" name="n88">88</a></span> <span class="comment">#Todo</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n89" name="n89">89</a></span> params_mission = {<span class="key">name</span>: params[<span class="symbol">:name</span>],<span class="key">project_id</span>: params[<span class="symbol">:project_id</span>],<span class="key">content</span>: params[<span class="symbol">:content</span>],<span class="key">deadline</span>: params[<span class="symbol">:deadline</span>],<span class="key">priority</span>: params[<span class="symbol">:priority</span>],<span class="key">status</span>: params[<span class="symbol">:status</span>]}
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><strong><a href="#n90" name="n90">90</a></strong></span> mission = <span class="constant">Mission</span>.new(params_mission)
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n91" name="n91">91</a></span> <span class="keyword">if</span> mission.save
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n92" name="n92">92</a></span> render <span class="symbol">:json</span> => {<span class="symbol">:code</span> => <span class="integer">0</span>}
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n93" name="n93">93</a></span> <span class="keyword">else</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n94" name="n94">94</a></span> render <span class="key">json</span>: mission.errors, <span class="key">status</span>: <span class="symbol">:unprocessable_entity</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n95" name="n95">95</a></span> <span class="keyword">end</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n96" name="n96">96</a></span> userids = params[<span class="symbol">:users</span>]
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n97" name="n97">97</a></span> userids.each <span class="keyword">do</span> |id|
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n98" name="n98">98</a></span> user_enties = <span class="constant">User</span>.find_by(<span class="key">id</span>: id)
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"> <a href="#n99" name="n99">99</a></span> <span class="comment">#puts user_enties.inspect</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><strong><a href="#n100" name="n100">100</a></strong></span> params_mu = {<span class="key">mission_id</span>: mission.id,<span class="key">user_id</span>: user_enties.id}
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n101" name="n101">101</a></span> missions_user = <span class="constant">Missions_user</span>.new(params_mu)
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n102" name="n102">102</a></span> missions_user.save
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n103" name="n103">103</a></span> content = <span class="string"><span class="delimiter">"</span><span class="content"> <a></span><span class="delimiter">"</span></span>+mission.name+<span class="string"><span class="delimiter">"</span><span class="content"></a></span><span class="delimiter">"</span></span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n104" name="n104">104</a></span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n105" name="n105">105</a></span> params_note = {<span class="key">content</span>: content,<span class="key">user_id</span>: user_enties.id,<span class="key">category</span>: <span class="integer">3</span>,<span class="key">project_id</span>: mission.project_id}
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n106" name="n106">106</a></span> note = <span class="constant">Note</span>.new(params_note)
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n107" name="n107">107</a></span> note.save
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n108" name="n108">108</a></span> <span class="keyword">end</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n109" name="n109">109</a></span> <span class="keyword">end</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><strong><a href="#n110" name="n110">110</a></strong></span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n111" name="n111">111</a></span> <span class="comment">#======================================></span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n112" name="n112">112</a></span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
<ul>
|
||
|
|
||
|
<li>move model logic into model (mission use_count > 4) » rails_best_practices</li>
|
||
|
|
||
|
</ul>
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n113" name="n113">113</a></span> <span class="keyword">def</span> <span class="function">update</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n114" name="n114">114</a></span> <span class="comment">#Todo</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n115" name="n115">115</a></span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n116" name="n116">116</a></span> id = params[<span class="symbol">:id</span>]
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n117" name="n117">117</a></span> <span class="comment">#now = Datetime.now</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n118" name="n118">118</a></span> mission = <span class="constant">Mission</span>.find_by(<span class="key">id</span>: id)
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n119" name="n119">119</a></span> params_mission = {<span class="key">name</span>: params[<span class="symbol">:name</span>],<span class="key">content</span>: params[<span class="symbol">:content</span>],<span class="key">deadline</span>: params[<span class="symbol">:deadline</span>],<span class="key">priority</span>: params[<span class="symbol">:priority</span>]}
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><strong><a href="#n120" name="n120">120</a></strong></span> <span class="comment">#puts params_mission</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n121" name="n121">121</a></span> mission.update(params_mission)
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n122" name="n122">122</a></span> mission.save
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n123" name="n123">123</a></span> <span class="constant">Missions_user</span>.delete_all([<span class="string"><span class="delimiter">"</span><span class="content">mission_id = ?</span><span class="delimiter">"</span></span>,id])
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n124" name="n124">124</a></span> userids = params[<span class="symbol">:users</span>]
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n125" name="n125">125</a></span> userids.each <span class="keyword">do</span> |name|
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n126" name="n126">126</a></span> user_enties = <span class="constant">User</span>.find_by(<span class="key">id</span>: id)
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n127" name="n127">127</a></span> params = {<span class="key">mission_id</span>: id,<span class="key">user_id</span>: user_enties.id}
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n128" name="n128">128</a></span> missions_user = <span class="constant">Missions_user</span>.new(params)
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n129" name="n129">129</a></span> missions_user.save
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><strong><a href="#n130" name="n130">130</a></strong></span> content = <span class="string"><span class="delimiter">"</span><span class="content"><a></span><span class="delimiter">"</span></span>+mission.name + <span class="string"><span class="delimiter">"</span><span class="content"></a> </span><span class="delimiter">"</span></span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n131" name="n131">131</a></span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n132" name="n132">132</a></span> params_note = {<span class="key">content</span>: content,<span class="key">user_id</span>: user_enties.id,<span class="key">category</span>: <span class="integer">3</span>,<span class="key">project_id</span>: mission.project_id}
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n133" name="n133">133</a></span> note = <span class="constant">Note</span>.new(params_note)
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n134" name="n134">134</a></span> note.save
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n135" name="n135">135</a></span> <span class="keyword">end</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n136" name="n136">136</a></span> render <span class="symbol">:json</span> => {<span class="symbol">:code</span> => <span class="integer">0</span>}
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n137" name="n137">137</a></span> <span class="keyword">end</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n138" name="n138">138</a></span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n139" name="n139">139</a></span> <span class="comment">#======================================></span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><strong><a href="#n140" name="n140">140</a></strong></span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n141" name="n141">141</a></span> <span class="keyword">def</span> <span class="function">commentPublish</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n142" name="n142">142</a></span> <span class="comment">#Todo</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n143" name="n143">143</a></span> mission_id = params[<span class="symbol">:mission_id</span>]
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n144" name="n144">144</a></span> content = params[<span class="symbol">:content</span>]
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n145" name="n145">145</a></span> user_id = session[<span class="symbol">:user_id</span>]
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n146" name="n146">146</a></span> params = {<span class="key">content</span>: content, <span class="key">mission_id</span>: mission_id, <span class="key">user_id</span>: user_id}
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n147" name="n147">147</a></span> comment = <span class="constant">Comment</span>.new(params)
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n148" name="n148">148</a></span> <span class="keyword">if</span> comment.save
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n149" name="n149">149</a></span> render <span class="symbol">:json</span> => {<span class="symbol">:code</span> => <span class="integer">0</span>}
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><strong><a href="#n150" name="n150">150</a></strong></span> <span class="keyword">else</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n151" name="n151">151</a></span> render <span class="key">json</span>: mission.errors, <span class="key">status</span>: <span class="symbol">:unprocessable_entity</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n152" name="n152">152</a></span> <span class="keyword">end</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n153" name="n153">153</a></span> <span class="keyword">end</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td valign='top'>
|
||
|
|
||
|
|
||
|
|
||
|
</td>
|
||
|
<td valign='top'>
|
||
|
<div class="CodeRay">
|
||
|
<div class="code"><pre><span class="line-numbers"><a href="#n154" name="n154">154</a></span><span class="keyword">end</span></pre></div>
|
||
|
</div>
|
||
|
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
</table>
|
||
|
</body>
|
||
|
</html>
|