diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 090ddf6..b359864 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -8,9 +8,9 @@ class ProjectsController < ApplicationController def index #Todo uid = session[:user_id] - pid = Project_user.find(uid) + pid = Projects_user.find_by(project_id: uid) mc = Mission.where(:project_id => pid).size - uc = Project_user.where(:project_id => pid).size + uc = Projects_user.where(:project_id => pid).size sc = Share.where(:project_id => pid).size data = [] Project.find(pid) do |i| @@ -67,8 +67,8 @@ class ProjectsController < ApplicationController def detail #Todo pid = params[:id] - project = Project.find(pid) - uid = Project_user.where(:project_id => pid) + project = Project.find_by(id: pid) + uid = Projects_user.where(:project_id => pid) users = [] Users.find(uid).each do |i| users += [{ diff --git a/db/seeds.rb b/db/seeds.rb index 3f8f98d..c849e66 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -6,7 +6,8 @@ # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel', city: cities.first) users = [ - {:name => '杨诏', :password => '123123123', :email => 'lucio.yang@qq.com', :phone => '15652591529', :created_at => "2016/12/27", :updated_at => "2016/12/27"} + {:name => '杨诏', :password => '123123123', :email => 'lucio.yang@qq.com', :phone => '15652591529', :created_at => "2016/12/27", :updated_at => "2016/12/27"}, + {:name => '陈翊', :password => '123456', :email => '1085730215@qq.com', :phone => '18269771988', :created_at => "2016/12/28", :updated_at => "2016/12/27"} ] users.each do |user| diff --git a/public/pages/project_select.html b/public/pages/project_select.html index a54c6db..798467a 100644 --- a/public/pages/project_select.html +++ b/public/pages/project_select.html @@ -77,94 +77,30 @@
-
-
+
+ -