tag_name从ProjectInfo取用户抛错的问题

不查询网站信息(删东西
gemfile加pry判定
This commit is contained in:
yanxd 2014-06-03 11:19:20 +08:00
parent 2e9251530c
commit 789a8d1392
5 changed files with 24 additions and 54 deletions

View File

@ -19,6 +19,10 @@ gem 'acts-as-taggable-on'
group :development do
gem 'better_errors', path: 'lib/better_errors'
gem 'rack-mini-profiler', path: 'lib/rack-mini-profiler'
if ENV['PRY']
gem 'pry'
gem 'pry-nav'
end
end
# Gems used only for assets and not required

View File

@ -21,13 +21,7 @@ class WelcomeController < ApplicationController
before_filter :entry_select_course, :entry_select_contest, :entry_select_user, :only => [:index]
def index
projectActive = Project.project_entities.active
@projectCount = projectActive.count
@projectPublicCount = projectActive.all_public.count
@projectHidenCount = @projectCount - @projectPublicCount
@developerCount = User.developer.count
@allUsercount = User.count
end
def robots
@ -36,10 +30,7 @@ class WelcomeController < ApplicationController
end
def course
@courseCount = Project.course_entities.count
@teacherCount = User.teacher.count
@studentCount = User.student.count
@logoLink = logolink()
@logoLink ||= logolink()
end
@ -121,25 +112,25 @@ class WelcomeController < ApplicationController
end
end
def render(*args)
_fake if @fake_filter
super
end
# def render(*args)
# _fake if @fake_filter
# super
# end
private
# private
def fake
@fake_filter = true
end
# def fake
# @fake_filter = true
# end
# 骗子方法
def _fake
instance_variables.map { |variable|
if variable.to_s =~ /Count$/
self.instance_variable_set(variable.to_sym,
("1" + (self.instance_variable_get(variable.to_sym).to_s)).to_i)
end
}
end
# # 骗子方法
# def _fake
# instance_variables.map { |variable|
# if variable.to_s =~ /Count$/
# self.instance_variable_set(variable.to_sym,
# ("1" + (self.instance_variable_get(variable.to_sym).to_s)).to_i)
# end
# }
# end
end

View File

@ -51,14 +51,14 @@
<% when '2' %>
<% if (ProjectInfo.find_by_project_id(obj.id)).user_id == User.current.id %>
<% if (ProjectInfo.find_by_project_id(obj.id)).try(:user_id) == User.current.id %>
<span class='del'> <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
:taggable_id => obj.id, :taggable_type => object_flag %> </span>
<% end %>
<% when '3' %>
<% if (ProjectInfo.find_by_project_id(obj.project_id)).user_id == User.current.id %>
<% if (ProjectInfo.find_by_project_id(obj.project_id)).try(:user_id) == User.current.id %>
<span class='del'> <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
:taggable_id => obj.id, :taggable_type => object_flag %> </span>
<% end %>

View File

@ -259,17 +259,4 @@
</div>
<div class="clearfix"></div>
<div class="hidden" style="width:100%;">
<div style="width:600px;margin:0px auto;margin-top:80px;">
<table style="width:600px;font-size:15px; color: #e8770d;">
<tr>
<td><strong>当前网站状态</strong></td>
<td>活跃课程: <%=@courseCount%></td>
<td>高校: 2个</td>
<td>教师: <%=@teacherCount%> 名</td>
<td>学生: <%=@studentCount%> 名<td>
</tr>
</table>
</div>
</div>
<%= render partial: 'link_to_another' %>

View File

@ -137,16 +137,4 @@
<div class="clearfix"></div>
<div class="hidden" style="width:100%;">
<div style="width:600px;margin:0px auto;margin-top:180px;">
<table style="width:600px;font-size:15px; color: gray;">
<tr>
<td><strong>当前网站状态</strong></td>
<td>活跃项目:<%=@projectCount%>个</td>
<td>私有项目: <%=@projectHidenCount%>个</td>
<td>开发者:<%=@allUsercount%>个 </td>
</tr>
</table>
</div>
</div>
<%= render partial: 'link_to_another' %>