删除项目,竞赛表project_id会置空,projecting_softapplications模型不知道干嘛用,此表也不存在
This commit is contained in:
parent
cccbd941ce
commit
18d096f0d8
|
@ -19,20 +19,20 @@ class SoftapplicationsController < ApplicationController
|
||||||
|
|
||||||
#new added sort
|
#new added sort
|
||||||
if params[:softapplication_sort_type].present?
|
if params[:softapplication_sort_type].present?
|
||||||
case params[:softapplication_sort_type]
|
case params[:softapplication_sort_type]
|
||||||
when '0'
|
when '0'
|
||||||
@softapplications = @softapplications[@offset, @limit]
|
@softapplications = @softapplications[@offset, @limit]
|
||||||
@s_state = 0
|
@s_state = 0
|
||||||
when '1'
|
when '1'
|
||||||
@softapplications = @softapplications.sort { |x, y| y[:created_at] <=> x[:created_at]}[@offset, @limit]
|
@softapplications = @softapplications.sort { |x, y| y[:created_at] <=> x[:created_at]}[@offset, @limit]
|
||||||
@s_state = 1
|
@s_state = 1
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@softapplications = @softapplications.sort { |x, y| y[:created_at] <=> x[:created_at]}[@offset, @limit]
|
@softapplications = @softapplications.sort { |x, y| y[:created_at] <=> x[:created_at]}[@offset, @limit]
|
||||||
@s_state = 1
|
@s_state = 1
|
||||||
end
|
end
|
||||||
#new added end
|
#new added end
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html # index.html.erb
|
format.html # index.html.erb
|
||||||
format.json { render json: @softapplications }
|
format.json { render json: @softapplications }
|
||||||
|
@ -216,19 +216,19 @@ class SoftapplicationsController < ApplicationController
|
||||||
def new_message
|
def new_message
|
||||||
@jour = JournalsForMessage.find(params[:journal_id]) if params[:journal_id]
|
@jour = JournalsForMessage.find(params[:journal_id]) if params[:journal_id]
|
||||||
if @jour
|
if @jour
|
||||||
user = @jour.user
|
user = @jour.user
|
||||||
text = @jour.notes
|
text = @jour.notes
|
||||||
else
|
else
|
||||||
user = @softapplication.user
|
user = @softapplication.user
|
||||||
text = @softapplication.description
|
text = @softapplication.description
|
||||||
end
|
end
|
||||||
text = text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]')
|
text = text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]')
|
||||||
@content = "> #{ll(User.current.language, :text_user_wrote, user)}\n> "
|
@content = "> #{ll(User.current.language, :text_user_wrote, user)}\n> "
|
||||||
@content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
|
@content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
|
||||||
@id = user.id
|
@id = user.id
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
render_404
|
render_404
|
||||||
end
|
end
|
||||||
|
|
||||||
#新建评价
|
#新建评价
|
||||||
def create_message
|
def create_message
|
||||||
|
|
|
@ -10,7 +10,6 @@ class Softapplication < ActiveRecord::Base
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
belongs_to :project
|
belongs_to :project
|
||||||
has_many :contests, :through => :contesting_softapplications
|
has_many :contests, :through => :contesting_softapplications
|
||||||
belongs_to :project
|
|
||||||
|
|
||||||
def add_jour(user, notes, reference_user_id = 0, options = {})
|
def add_jour(user, notes, reference_user_id = 0, options = {})
|
||||||
if options.count == 0
|
if options.count == 0
|
||||||
|
|
Loading…
Reference in New Issue