删除项目,竞赛表project_id会置空,projecting_softapplications模型不知道干嘛用,此表也不存在

This commit is contained in:
yanxd 2014-07-22 17:40:32 +08:00
parent cccbd941ce
commit 18d096f0d8
2 changed files with 13 additions and 14 deletions

View File

@ -19,17 +19,17 @@ class SoftapplicationsController < ApplicationController
#new added sort
if params[:softapplication_sort_type].present?
case params[:softapplication_sort_type]
case params[:softapplication_sort_type]
when '0'
@softapplications = @softapplications[@offset, @limit]
@softapplications = @softapplications[@offset, @limit]
@s_state = 0
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
end
else
@softapplications = @softapplications.sort { |x, y| y[:created_at] <=> x[:created_at]}[@offset, @limit]
@s_state = 1
else
@softapplications = @softapplications.sort { |x, y| y[:created_at] <=> x[:created_at]}[@offset, @limit]
@s_state = 1
end
#new added end
@ -216,19 +216,19 @@ class SoftapplicationsController < ApplicationController
def new_message
@jour = JournalsForMessage.find(params[:journal_id]) if params[:journal_id]
if @jour
user = @jour.user
text = @jour.notes
user = @jour.user
text = @jour.notes
else
user = @softapplication.user
text = @softapplication.description
user = @softapplication.user
text = @softapplication.description
end
text = text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]')
@content = "> #{ll(User.current.language, :text_user_wrote, user)}\n> "
@content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
@id = user.id
rescue ActiveRecord::RecordNotFound
rescue ActiveRecord::RecordNotFound
render_404
end
end
#新建评价
def create_message

View File

@ -10,7 +10,6 @@ class Softapplication < ActiveRecord::Base
belongs_to :user
belongs_to :project
has_many :contests, :through => :contesting_softapplications
belongs_to :project
def add_jour(user, notes, reference_user_id = 0, options = {})
if options.count == 0