解决冲突
This commit is contained in:
parent
ef231ee9d4
commit
f3c0f9cde9
|
@ -1,126 +1,126 @@
|
||||||
class TestController < ApplicationController
|
# class TestController < ApplicationController
|
||||||
|
#
|
||||||
before_filter :find_user, :only => [:new, :create, :destroy]
|
# before_filter :find_user, :only => [:new, :create, :destroy]
|
||||||
|
#
|
||||||
|
#
|
||||||
def index
|
# def index
|
||||||
#@watchers_of_projects = WatchersOfProjects.new
|
# #@watchers_of_projects = WatchersOfProjects.new
|
||||||
#@watchers_of_projects.user_id = 1
|
# #@watchers_of_projects.user_id = 1
|
||||||
#@watchers_of_projects.project_id = 1
|
# #@watchers_of_projects.project_id = 1
|
||||||
#@watchers_of_projects.save
|
# #@watchers_of_projects.save
|
||||||
|
#
|
||||||
#测试user表与watch_project表之间的关联是否成功
|
# #测试user表与watch_project表之间的关联是否成功
|
||||||
#@user = User.find(params[:id])
|
# #@user = User.find(params[:id])
|
||||||
#@watch_table = @user.watch_projects.to_a.first
|
# #@watch_table = @user.watch_projects.to_a.first
|
||||||
|
#
|
||||||
#@watch = WatchProject.find(1)
|
# #@watch = WatchProject.find(1)
|
||||||
#@watcher = @watch.user
|
# #@watcher = @watch.user
|
||||||
|
#
|
||||||
#测试通过watch_project表使user表可以访问project表
|
# #测试通过watch_project表使user表可以访问project表
|
||||||
#@watch_project = @user.projects
|
# #@watch_project = @user.projects
|
||||||
#watch_project_path(@watch)
|
# #watch_project_path(@watch)
|
||||||
|
#
|
||||||
#@project = Project.find(11)
|
# #@project = Project.find(11)
|
||||||
#project_path(@project)
|
# #project_path(@project)
|
||||||
#@member = @project.users
|
# #@member = @project.users
|
||||||
#@watched = @project.watch_projects
|
# #@watched = @project.watch_projects
|
||||||
#@issue = Issue.find(6)
|
# #@issue = Issue.find(6)
|
||||||
|
#
|
||||||
|
#
|
||||||
#user_path(@user)
|
# #user_path(@user)
|
||||||
#issue_path(@issue)
|
# #issue_path(@issue)
|
||||||
|
#
|
||||||
#@watcher2=WatchProject.where("#{WatchProject.table_name}.project_id = ?" , temp)
|
# #@watcher2=WatchProject.where("#{WatchProject.table_name}.project_id = ?" , temp)
|
||||||
|
#
|
||||||
#测试where语句
|
# #测试where语句
|
||||||
#temp = 1
|
# #temp = 1
|
||||||
#@watcher2=WatchProject.where(:project_id => temp).to_a
|
# #@watcher2=WatchProject.where(:project_id => temp).to_a
|
||||||
|
#
|
||||||
#测试新建记录
|
# #测试新建记录
|
||||||
#@watch_new = WatchProject.new
|
# #@watch_new = WatchProject.new
|
||||||
#@watch_new.user_id = 4
|
# #@watch_new.user_id = 4
|
||||||
#@watch_new.project_id = 1
|
# #@watch_new.project_id = 1
|
||||||
#@watch_new.save
|
# #@watch_new.save
|
||||||
#@id = params[:id]
|
# #@id = params[:id]
|
||||||
|
#
|
||||||
#测试添加关注项目功能
|
# #测试添加关注项目功能
|
||||||
#WatchersOfProjects.watch(3,10)
|
# #WatchersOfProjects.watch(3,10)
|
||||||
#Project.find(50)
|
# #Project.find(50)
|
||||||
#测试统计关注该项目的用户数
|
# #测试统计关注该项目的用户数
|
||||||
#@count = WatchersOfProjects.watcher_count(@watch_project.to_a.first)
|
# #@count = WatchersOfProjects.watcher_count(@watch_project.to_a.first)
|
||||||
#测试取消关注功能
|
# #测试取消关注功能
|
||||||
#WatchersOfProjects.watch_cancle(10,35)
|
# #WatchersOfProjects.watch_cancle(10,35)
|
||||||
|
#
|
||||||
#测试关注用户功能
|
# #测试关注用户功能
|
||||||
#测试关注功能
|
# #测试关注功能
|
||||||
#WatchersOfUser.watch_user(7,7)
|
# #WatchersOfUser.watch_user(7,7)
|
||||||
#测试取消关注功能
|
# #测试取消关注功能
|
||||||
#WatchersOfUser.cancel_watching_user(1,2)
|
# #WatchersOfUser.cancel_watching_user(1,2)
|
||||||
#测试查找关注的人功能
|
# #测试查找关注的人功能
|
||||||
#@user = WatchersOfUser.find_users(1)
|
# #@user = WatchersOfUser.find_users(1)
|
||||||
#测试查找被关注的人功能
|
# #测试查找被关注的人功能
|
||||||
#@user = WatchersOfUser.find_watchers(10)
|
# #@user = WatchersOfUser.find_watchers(10)
|
||||||
|
#
|
||||||
#测试用户留言功能
|
# #测试用户留言功能
|
||||||
#测试留言功能
|
# #测试留言功能
|
||||||
MessagesForUser.leave_message(User.current.id, 6, 'test')
|
# MessagesForUser.leave_message(User.current.id, 6, 'test')
|
||||||
#测试查找留言功能
|
# #测试查找留言功能
|
||||||
#@message_table = MessagesForUser.find_message(3)
|
# #@message_table = MessagesForUser.find_message(3)
|
||||||
#测试查找留言用户功能
|
# #测试查找留言用户功能
|
||||||
#@messager=@message_table.first.find_messager
|
# #@messager=@message_table.first.find_messager
|
||||||
|
#
|
||||||
|
#
|
||||||
#测试需求
|
# #测试需求
|
||||||
#测试新建需求
|
# #测试新建需求
|
||||||
#bids = Bid.creat_bids(10000, '2013.7.25', 'test', 'sfsadgfag')
|
# #bids = Bid.creat_bids(10000, '2013.7.25', 'test', 'sfsadgfag')
|
||||||
#测试修改需求
|
# #测试修改需求
|
||||||
#bids.update_bids(10, '2014.7.222', 'asdf')
|
# #bids.update_bids(10, '2014.7.222', 'asdf')
|
||||||
#测试删除需求
|
# #测试删除需求
|
||||||
# bids = Bid.where('id = ?', 5)
|
# # bids = Bid.where('id = ?', 5)
|
||||||
# bids.each do |bid|
|
# # bids.each do |bid|
|
||||||
# bid.delete_bids
|
# # bid.delete_bids
|
||||||
|
# # end
|
||||||
# end
|
# end
|
||||||
end
|
#
|
||||||
|
# ##########留言功能 message by fq
|
||||||
##########留言功能 message by fq
|
# def new
|
||||||
def new
|
# end
|
||||||
end
|
#
|
||||||
|
# def create
|
||||||
def create
|
#
|
||||||
|
# if params[:user_search].size>0
|
||||||
if params[:user_search].size>0
|
# unless params[:user_id].nil?
|
||||||
unless params[:user_id].nil?
|
# message = params[:user_search]
|
||||||
message = params[:user_search]
|
# MessagesForUser.leave_message(User.current.id, params[:user_id], message)
|
||||||
MessagesForUser.leave_message(User.current.id, params[:user_id], message)
|
# @message = MessagesForUser.find_message(@user.id)
|
||||||
@message = MessagesForUser.find_message(@user.id)
|
# end
|
||||||
end
|
# end
|
||||||
end
|
#
|
||||||
|
# respond_to do |format|
|
||||||
respond_to do |format|
|
# # format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}}
|
||||||
# format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}}
|
# format.js
|
||||||
format.js
|
# #format.api { render_api_ok }
|
||||||
#format.api { render_api_ok }
|
# end
|
||||||
end
|
# end
|
||||||
end
|
#
|
||||||
|
# def destroy
|
||||||
def destroy
|
# MessagesForUser.delete_message(params[:object_id])
|
||||||
MessagesForUser.delete_message(params[:object_id])
|
# @message = MessagesForUser.find_message(@user.id)
|
||||||
@message = MessagesForUser.find_message(@user.id)
|
# respond_to do |format|
|
||||||
respond_to do |format|
|
# format.html { redirect_to :back }
|
||||||
format.html { redirect_to :back }
|
# format.js
|
||||||
format.js
|
# #format.api { render_api_ok }
|
||||||
#format.api { render_api_ok }
|
# end
|
||||||
end
|
# end
|
||||||
end
|
#
|
||||||
|
# private
|
||||||
private
|
#
|
||||||
|
# def find_user
|
||||||
def find_user
|
# if params[:user_id]
|
||||||
if params[:user_id]
|
# @user = User.find(params[:user_id])
|
||||||
@user = User.find(params[:user_id])
|
# end
|
||||||
end
|
# rescue
|
||||||
rescue
|
# render_404
|
||||||
render_404
|
# end
|
||||||
end
|
# #######end of message
|
||||||
#######end of message
|
# end
|
||||||
end
|
|
|
@ -59,7 +59,8 @@ class Project < ActiveRecord::Base
|
||||||
:join_table => "#{table_name_prefix}custom_fields_projects#{table_name_suffix}",
|
:join_table => "#{table_name_prefix}custom_fields_projects#{table_name_suffix}",
|
||||||
:association_foreign_key => 'custom_field_id'
|
:association_foreign_key => 'custom_field_id'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
has_many :tags, :through => :project_tags, :class_name => 'Tag'
|
has_many :tags, :through => :project_tags, :class_name => 'Tag'
|
||||||
has_many :project_tags, :class_name => 'ProjectTags'
|
has_many :project_tags, :class_name => 'ProjectTags'
|
||||||
|
|
|
@ -75,8 +75,9 @@ class User < Principal
|
||||||
has_one :rss_token, :class_name => 'Token', :conditions => "action='feeds'"
|
has_one :rss_token, :class_name => 'Token', :conditions => "action='feeds'"
|
||||||
has_one :api_token, :class_name => 'Token', :conditions => "action='api'"
|
has_one :api_token, :class_name => 'Token', :conditions => "action='api'"
|
||||||
belongs_to :auth_source
|
belongs_to :auth_source
|
||||||
|
|
||||||
#####fq
|
|
||||||
|
#####fq
|
||||||
has_many :jours, :class_name => 'JournalsForMessage', :dependent => :destroy
|
has_many :jours, :class_name => 'JournalsForMessage', :dependent => :destroy
|
||||||
has_many :bids, :foreign_key => 'author_id', :dependent => :destroy
|
has_many :bids, :foreign_key => 'author_id', :dependent => :destroy
|
||||||
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
||||||
|
|
Loading…
Reference in New Issue