2435 lines
60 KiB
HTML
2435 lines
60 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">ProjectsController</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">:index</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">: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="#n7" name="n7">7</a></span> <span class="symbol">:addUsers</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">: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="#n9" name="n9">9</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"><strong><a href="#n10" name="n10">10</a></strong></span> <span class="symbol">:deleteUsers</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> ]
|
|
</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="comment">#=============================================>user_idsession.</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="keyword">def</span> <span class="function">index</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> <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="#n16" name="n16">16</a></span> uid = 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="#n17" name="n17">17</a></span> data=[]
|
|
</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> <span class="constant">Projects_user</span>.where(<span class="symbol">:user_id</span> => uid).each <span class="keyword">do</span> |i|
|
|
</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> pid=i.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"><strong><a href="#n20" name="n20">20</a></strong></span> p=<span class="constant">Project</span>.find_by(<span class="key">id</span>:pid)
|
|
</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> mc = <span class="constant">Mission</span>.where(<span class="symbol">:project_id</span> => pid).size
|
|
</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> uc = <span class="constant">Projects_user</span>.where(<span class="symbol">:project_id</span> => pid).size
|
|
</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> sc = <span class="constant">Share</span>.where(<span class="symbol">:project_id</span> => pid).size
|
|
</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> data+=[{
|
|
</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> <span class="symbol">:id</span> => pid,
|
|
</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">:name</span> => p.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="#n27" name="n27">27</a></span> <span class="symbol">:content</span> => p.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="#n28" name="n28">28</a></span> <span class="symbol">:mission_count</span> => mc,
|
|
</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> <span class="symbol">:users_count</span> => uc,
|
|
</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> <span class="symbol">:shares_count</span> => sc
|
|
</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> }]
|
|
</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> <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="#n33" name="n33">33</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="#n34" name="n34">34</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="#n35" name="n35">35</a></span> <span class="symbol">:data</span> => data
|
|
</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> }
|
|
</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="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="#n38" name="n38">38</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="#n39" name="n39">39</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="#n40" name="n40">40</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="#n41" name="n41">41</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="#n42" name="n42">42</a></span> uid = 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="#n43" name="n43">43</a></span> project = <span class="constant">Project</span>.new(project_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="#n44" name="n44">44</a></span> <span class="keyword">if</span> project.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="#n45" name="n45">45</a></span> <span class="constant">Projects_user</span>.create(<span class="key">project_id</span>:project.id,<span class="key">user_id</span>:uid)
|
|
</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> render <span class="key">status</span>: <span class="symbol">:created</span>, <span class="key">nothing</span>: <span class="predefined-constant">true</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> <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="#n48" name="n48">48</a></span> render <span class="key">json</span>: project.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="#n49" name="n49">49</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="#n50" name="n50">50</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="#n51" name="n51">51</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="#n52" name="n52">52</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="#n53" name="n53">53</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="#n54" name="n54">54</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="#n55" name="n55">55</a></span> <span class="keyword">def</span> <span class="function">addUsers</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> uid = <span class="constant">User</span>.find_by(<span class="key">email</span>:params[<span class="symbol">:email</span>]).id<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="#n57" name="n57">57</a></span> register = session[<span class="symbol">:user_id</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="#n58" name="n58">58</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="#n59" name="n59">59</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="#n60" name="n60">60</a></strong></span> pu_exist=<span class="constant">Projects_user</span>.find_by(<span class="key">project_id</span>:pid,<span class="key">user_id</span>:uid)
|
|
</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">if</span> pu_exist.nil?<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="#n62" name="n62">62</a></span> params_pu = {<span class="key">project_id</span>: pid,<span class="key">user_id</span>: uid}
|
|
</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> pu = <span class="constant">Projects_user</span>.new(params_pu)
|
|
</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> pu.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="#n65" name="n65">65</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="#n66" name="n66">66</a></span> content = <span class="string"><span class="delimiter">"</span><span class="content"><a></span><span class="delimiter">"</span></span>+<span class="constant">User</span>.find_by(<span class="key">id</span>: register).name + <span class="string"><span class="delimiter">"</span><span class="content"></a> <a></span><span class="delimiter">"</span></span> + <span class="constant">Project</span>.find_by(<span class="key">id</span>: pid).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="#n67" name="n67">67</a></span> puts 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> params_note = {<span class="key">user_id</span>: uid,<span class="key">content</span>: content,<span class="key">category</span>: <span class="integer">2</span>,<span class="key">project_id</span>: pid}
|
|
</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> 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"><strong><a href="#n70" name="n70">70</a></strong></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="#n71" name="n71">71</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="#n72" name="n72">72</a></span> <span class="keyword">else</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="#n73" name="n73">73</a></span> render <span class="key">json</span>:current_user.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="#n74" name="n74">74</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="#n75" name="n75">75</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="#n76" name="n76">76</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="#n77" name="n77">77</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="#n78" name="n78">78</a></span> <span class="keyword">def</span> <span class="function">deleteUsers</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="#n79" name="n79">79</a></span> uid = params[<span class="symbol">:user_id</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="#n80" name="n80">80</a></strong></span> register = session[<span class="symbol">:user_id</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="#n81" name="n81">81</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="#n82" name="n82">82</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="#n83" name="n83">83</a></span> projects_user=<span class="constant">Projects_user</span>.find_by(<span class="key">project_id</span>:pid,<span class="key">user_id</span>:uid)
|
|
</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">if</span> projects_user.nil?<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="#n85" name="n85">85</a></span> render <span class="key">json</span>:current_user.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="#n86" name="n86">86</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="#n87" name="n87">87</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="#n88" name="n88">88</a></span> puts projects_user.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="#n89" name="n89">89</a></span> puts projects_user.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"><strong><a href="#n90" name="n90">90</a></strong></span> <span class="constant">Projects_user</span>.where(<span class="key">project_id</span>:pid,<span class="key">user_id</span>:uid).delete_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="#n91" name="n91">91</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="#n92" name="n92">92</a></span> content =<span class="string"><span class="delimiter">"</span><span class="content"><a></span><span class="delimiter">"</span></span>+ <span class="constant">User</span>.find_by(<span class="key">id</span>: register).name + <span class="string"><span class="delimiter">"</span><span class="content"></a> <a></span><span class="delimiter">"</span></span> + <span class="constant">Project</span>.find_by(<span class="key">id</span>: pid).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="#n93" name="n93">93</a></span> puts 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="#n94" name="n94">94</a></span> params_note = {<span class="key">user_id</span>: uid,<span class="key">content</span>: content,<span class="key">category</span>: <span class="integer">2</span>,<span class="key">project_id</span>: pid}
|
|
</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> 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="#n96" name="n96">96</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="#n97" name="n97">97</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="#n98" name="n98">98</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="#n99" name="n99">99</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="#n100" name="n100">100</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="#n101" name="n101">101</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="#n102" name="n102">102</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="#n103" name="n103">103</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="#n104" name="n104">104</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="#n105" name="n105">105</a></span> pid = 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="#n106" name="n106">106</a></span> project = <span class="constant">Project</span>.find_by(<span class="key">id</span>: pid)
|
|
</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> <span class="comment">#uid = Projects_user.where(:project_id => pid)</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="#n108" name="n108">108</a></span> users = []
|
|
</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> projects_users = <span class="constant">Projects_user</span>.where(<span class="string"><span class="delimiter">"</span><span class="content">project_id = ?</span><span class="delimiter">"</span></span>,pid).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="#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> projects_users.each <span class="keyword">do</span> |projects_user|
|
|
</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> uid = projects_user.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="#n113" name="n113">113</a></span> i = <span class="constant">User</span>.find_by(<span class="key">id</span>: uid)
|
|
</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> users += [{
|
|
</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> <span class="symbol">:name</span> => i.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="#n116" name="n116">116</a></span> <span class="symbol">:id</span> => i.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="#n117" name="n117">117</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="#n118" name="n118">118</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="#n119" name="n119">119</a></span> <span class="comment">#puts users.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="#n120" name="n120">120</a></strong></span> <span class="comment"># Users.find(uid).each 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="#n121" name="n121">121</a></span> <span class="comment"># 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="#n122" name="n122">122</a></span> <span class="comment"># :nickname => 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="#n123" name="n123">123</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="#n124" name="n124">124</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="#n125" name="n125">125</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"><a href="#n126" name="n126">126</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="#n127" name="n127">127</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="#n128" name="n128">128</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="#n129" name="n129">129</a></span> <span class="symbol">:name</span> => project.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"><strong><a href="#n130" name="n130">130</a></strong></span> <span class="symbol">:content</span> => project.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="#n131" name="n131">131</a></span> <span class="symbol">:users</span> => users
|
|
</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> }
|
|
</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> }
|
|
</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> <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="#n135" name="n135">135</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="#n136" name="n136">136</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="#n137" name="n137">137</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="#n138" name="n138">138</a></span> project = <span class="constant">Project</span>.find_by(<span class="symbol">:id</span> => params[<span class="symbol">:project</span>][<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="#n139" name="n139">139</a></span> <span class="keyword">if</span> project.update(project_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"><strong><a href="#n140" name="n140">140</a></strong></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="#n141" name="n141">141</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="#n142" name="n142">142</a></span> render <span class="key">json</span>:current_user.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="#n143" name="n143">143</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="#n144" name="n144">144</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="#n145" name="n145">145</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="#n146" name="n146">146</a></span> private
|
|
</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> <span class="keyword">def</span> <span class="function">project_params</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="#n148" name="n148">148</a></span> params.require(<span class="symbol">:project</span>).permit(<span class="symbol">:name</span>,<span class="symbol">:content</span>,<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="#n149" name="n149">149</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="#n150" name="n150">150</a></strong></span><span class="keyword">end</span></pre></div>
|
|
</div>
|
|
|
|
</td>
|
|
</tr>
|
|
|
|
</table>
|
|
</body>
|
|
</html>
|